use of org.cloudfoundry.credhub.auth.UserContext in project credhub by cloudfoundry-incubator.
the class CertificatesHandlerTest method beforeEach.
@Before
public void beforeEach() {
Encryptor encryptor = mock(Encryptor.class);
permissionedCertificateService = mock(PermissionedCertificateService.class);
permissionCheckingService = mock(PermissionCheckingService.class);
certificateService = mock(CertificateService.class);
universalCredentialGenerator = mock(UniversalCredentialGenerator.class);
generationRequestGenerator = mock(GenerationRequestGenerator.class);
subject = new CertificatesHandler(permissionedCertificateService, certificateService, universalCredentialGenerator, generationRequestGenerator);
userContext = mock(UserContext.class);
when(userContext.getActor()).thenReturn(USER);
}
use of org.cloudfoundry.credhub.auth.UserContext in project credhub by cloudfoundry-incubator.
the class SetHandlerTest method setUp.
@Before
public void setUp() throws Exception {
TestHelper.getBouncyCastleProvider();
credentialService = mock(PermissionedCredentialService.class);
certificateAuthorityService = mock(CertificateAuthorityService.class);
permissionService = mock(PermissionService.class);
userContext = new UserContext();
UserContextHolder userContextHolder = new UserContextHolder();
userContextHolder.setUserContext(userContext);
subject = new SetHandler(credentialService, permissionService, certificateAuthorityService, userContextHolder);
generationParameters = new StringGenerationParameters();
accessControlEntries = new ArrayList<>();
credentialVersion = mock(PasswordCredentialVersion.class);
when(credentialService.save(anyObject(), anyObject(), anyObject(), anyList())).thenReturn(credentialVersion);
}
Aggregations