use of keywhiz.api.BatchSecretRequest in project keywhiz by square.
the class BatchSecretDeliveryResourceTest method returnsNotFoundWhenOneOfSecretsDoesNotExistAndOneForbiddenReverse.
// One of the secrets doesn't exist AND one of the secrets not allowed => not found - to preserve compatibility
// This test builds a request in reverse of the previous one to test determinism
@Test(expected = NotFoundException.class)
public void returnsNotFoundWhenOneOfSecretsDoesNotExistAndOneForbiddenReverse() throws Exception {
ImmutableList<String> secretnames = ImmutableList.of(secret.getName(), "secretthatdoesnotexist");
BatchSecretRequest req = BatchSecretRequest.create(secretnames);
when(aclDAO.getBatchSanitizedSecretsFor(client, secretnames)).thenReturn(List.of());
when(clientDAO.getClientByName(client.getName())).thenReturn(Optional.of(client));
when(secretController.getSecretsByName(secretnames)).thenReturn(List.of(secret));
batchSecretDeliveryResource.getBatchSecret(client, req);
}
Aggregations