use of org.cloudfoundry.credhub.domain.JsonCredentialVersion in project credhub by cloudfoundry-incubator.
the class InterpolationControllerTest method POST_logsTheCredentialAccess.
@Test
public void POST_logsTheCredentialAccess() throws Exception {
JsonCredentialVersion jsonCredential = mock(JsonCredentialVersion.class);
doReturn(Maps.newHashMap("secret1", "secret1-value")).when(jsonCredential).getValue();
when(jsonCredential.getName()).thenReturn("/cred1");
JsonCredentialVersion jsonCredential1 = mock(JsonCredentialVersion.class);
doReturn(Maps.newHashMap("secret2", "secret2-value")).when(jsonCredential1).getValue();
when(jsonCredential1.getName()).thenReturn("/cred2");
doReturn(Arrays.asList(jsonCredential)).when(mockCredentialVersionDataService).findNByName("/cred1", 1);
doReturn(Arrays.asList(jsonCredential1)).when(mockCredentialVersionDataService).findNByName("/cred2", 1);
mockMvc.perform(makeValidPostRequest()).andExpect(status().isOk());
auditingHelper.verifyAuditing(UAA_OAUTH2_PASSWORD_GRANT_ACTOR_ID, "/api/v1/interpolate", 200, Lists.newArrayList(new EventAuditRecordParameters(CREDENTIAL_ACCESS, "/cred1"), new EventAuditRecordParameters(CREDENTIAL_ACCESS, "/cred2")));
}
Aggregations