use of io.dropwizard.jersey.params.LongParam in project keywhiz by square.
the class SecretsResourceTest method handlesNoAssociations.
@Test
public void handlesNoAssociations() {
when(secretController.getSecretById(22)).thenReturn(Optional.of(secret));
when(aclDAO.getGroupsFor(secret)).thenReturn(Collections.emptySet());
when(aclDAO.getClientsFor(secret)).thenReturn(Collections.emptySet());
SecretDetailResponse response = resource.retrieveSecret(user, new LongParam("22"));
assertThat(response.groups).isEmpty();
assertThat(response.clients).isEmpty();
}
use of io.dropwizard.jersey.params.LongParam in project keywhiz by square.
the class SecretsResourceTest method includesAssociations.
@Test
public void includesAssociations() {
Client client = new Client(0, "client", null, null, null, null, null, null, false, false);
Group group1 = new Group(0, "group1", null, null, null, null, null, null);
Group group2 = new Group(0, "group2", null, null, null, null, null, null);
when(secretController.getSecretById(22)).thenReturn(Optional.of(secret));
when(aclDAO.getGroupsFor(secret)).thenReturn(Sets.newHashSet(group1, group2));
when(aclDAO.getClientsFor(secret)).thenReturn(Sets.newHashSet(client));
SecretDetailResponse response = resource.retrieveSecret(user, new LongParam("22"));
assertThat(response.groups).containsOnly(group1, group2);
assertThat(response.clients).containsOnly(client);
}
use of io.dropwizard.jersey.params.LongParam in project keywhiz by square.
the class SecretsResourceTest method deleteErrorsOnNotFound.
@Test(expected = NotFoundException.class)
public void deleteErrorsOnNotFound() {
when(secretController.getSecretById(0xdeadbeef)).thenReturn(Optional.empty());
resource.deleteSecret(user, new LongParam(Long.toString(0xdeadbeef)));
}
use of io.dropwizard.jersey.params.LongParam in project keywhiz by square.
the class SecretsResourceTest method badIdNotFound.
@Test(expected = NotFoundException.class)
public void badIdNotFound() {
when(secretController.getSecretById(0xbad1d)).thenReturn(Optional.empty());
resource.retrieveSecret(user, new LongParam(Long.toString(0xbad1d)));
}
use of io.dropwizard.jersey.params.LongParam in project keywhiz by square.
the class SecretsResourceTest method rollbackThrowsException.
@Test(expected = NotFoundException.class)
public void rollbackThrowsException() {
doThrow(new NotFoundException()).when(secretDAO).setCurrentSecretVersionByName(eq("name2"), anyLong());
resource.resetSecretVersion(user, "name2", new LongParam("125"));
}
Aggregations