use of org.cloudfoundry.credhub.request.PermissionsRequest in project credhub by cloudfoundry-incubator.
the class PermissionsControllerTest method POST_returnsASuccessfulEmptyResponse.
@Test
public void POST_returnsASuccessfulEmptyResponse() throws Exception {
grantPermissions(mockMvc, "test-credential-name", UAA_OAUTH2_PASSWORD_GRANT_TOKEN, "test-actor", "read", "write");
ArgumentCaptor<PermissionsRequest> captor = ArgumentCaptor.forClass(PermissionsRequest.class);
verify(permissionsHandler, times(1)).setPermissions(captor.capture(), any(List.class));
PermissionsRequest permissionsRequest = captor.getValue();
List<PermissionEntry> accessControlEntries = permissionsRequest.getPermissions();
assertThat(accessControlEntries, hasItem(allOf(hasProperty("actor", equalTo("test-actor")), hasProperty("allowedOperations", hasItems(PermissionOperation.READ, PermissionOperation.WRITE)))));
}
Aggregations