use of org.pmiops.workbench.captcha.ApiException in project workbench by all-of-us.
the class ProfileControllerTest method setUp.
@BeforeEach
@Override
public void setUp() throws IOException {
super.setUp();
config.googleDirectoryService.gSuiteDomain = GSUITE_DOMAIN;
// key UserService logic depends on the existence of the Registered Tier
registeredTier = TestMockFactory.createRegisteredTierForTests(accessTierDao);
rtAddressesConfig = new InstitutionTierConfig().membershipRequirement(InstitutionMembershipRequirement.ADDRESSES).eraRequired(false).accessTierShortName(registeredTier.getShortName());
rtDomainsConfig = new InstitutionTierConfig().membershipRequirement(InstitutionMembershipRequirement.DOMAINS).eraRequired(false).accessTierShortName(registeredTier.getShortName());
Profile profile = new Profile();
profile.setContactEmail(CONTACT_EMAIL);
profile.setFamilyName(FAMILY_NAME);
profile.setGivenName(GIVEN_NAME);
profile.setUsername(USER_PREFIX);
profile.setAreaOfResearch(RESEARCH_PURPOSE);
profile.setAddress(new Address().streetAddress1(STREET_ADDRESS).city(CITY).state(STATE).country(COUNTRY).zipCode(ZIP_CODE));
createAccountRequest = new CreateAccountRequest();
createAccountRequest.setTermsOfServiceVersion(LATEST_AOU_TOS_VERSION);
createAccountRequest.setProfile(profile);
createAccountRequest.setCaptchaVerificationToken(CAPTCHA_TOKEN);
googleUser = new User();
googleUser.setPrimaryEmail(FULL_USER_NAME);
googleUser.setChangePasswordAtNextLogin(true);
googleUser.setPassword("testPassword");
googleUser.setIsEnrolledIn2Sv(true);
config.access.currentDuccVersions = ImmutableList.of(CURRENT_DUCC_VERSION);
when(mockDirectoryService.getUserOrThrow(FULL_USER_NAME)).thenReturn(googleUser);
when(mockDirectoryService.createUser(GIVEN_NAME, FAMILY_NAME, FULL_USER_NAME, CONTACT_EMAIL)).thenReturn(googleUser);
when(mockCloudStorageClient.getCaptchaServerKey()).thenReturn("Server_Key");
try {
when(mockCaptchaVerificationService.verifyCaptcha(CAPTCHA_TOKEN)).thenReturn(true);
when(mockCaptchaVerificationService.verifyCaptcha(WRONG_CAPTCHA_TOKEN)).thenReturn(false);
when(mockFireCloudService.getUserTermsOfServiceStatus()).thenReturn(true);
} catch (ApiException | org.pmiops.workbench.firecloud.ApiException e) {
e.printStackTrace();
}
accessModules = TestMockFactory.createAccessModules(accessModuleDao);
}
Aggregations