use of org.cloudfoundry.credhub.data.PermissionDataService in project credhub by cloudfoundry-incubator.
the class PermissionCheckingServiceTest method beforeEach.
@Before
public void beforeEach() {
userContext = mock(UserContext.class);
when(userContext.getActor()).thenReturn("test-actor");
permissionDataService = mock(PermissionDataService.class);
UserContextHolder userContextHolder = new UserContextHolder();
userContextHolder.setUserContext(userContext);
subject = new PermissionCheckingService(permissionDataService, userContextHolder);
}
use of org.cloudfoundry.credhub.data.PermissionDataService in project credhub by cloudfoundry-incubator.
the class PermissionServiceTest method beforeEach.
@Before
public void beforeEach() {
userContext = mock(UserContext.class);
when(userContext.getActor()).thenReturn(USER_NAME);
expectedCredential = new Credential(CREDENTIAL_NAME);
expectedCredentialVersion = new PasswordCredentialVersion(CREDENTIAL_NAME);
permissionDataService = mock(PermissionDataService.class);
permissionCheckingService = mock(PermissionCheckingService.class);
when(permissionCheckingService.hasPermission(anyString(), anyString(), any(PermissionOperation.class))).thenReturn(true);
auditRecordParameters = newArrayList();
UserContextHolder userContextHolder = new UserContextHolder();
userContextHolder.setUserContext(userContext);
subject = new PermissionService(permissionDataService, permissionCheckingService, userContextHolder);
}
Aggregations