use of org.pmiops.workbench.model.Profile in project workbench by all-of-us.
the class ProfileControllerTest method testSubmitEverything_success.
@Test
public void testSubmitEverything_success() throws Exception {
createUser();
when(blockscoreService.createPerson(eq("Bob"), eq(null), any(Address.class), eq(null), eq(null), eq(null))).thenReturn(person);
when(mailChimpService.getMember(CONTACT_EMAIL)).thenReturn("subscribed");
when(person.getId()).thenReturn("id");
when(person.isValid()).thenReturn(true);
WorkbenchConfig testConfig = new WorkbenchConfig();
testConfig.firecloud = new FireCloudConfig();
testConfig.firecloud.registeredDomainName = "";
when(configProvider.get()).thenReturn(testConfig);
Profile profile = profileController.completeEthicsTraining().getBody();
assertThat(profile.getDataAccessLevel()).isEqualTo(DataAccessLevel.UNREGISTERED);
profile = profileController.submitDemographicsSurvey().getBody();
assertThat(profile.getDataAccessLevel()).isEqualTo(DataAccessLevel.UNREGISTERED);
profile = profileController.submitTermsOfService().getBody();
assertThat(profile.getDataAccessLevel()).isEqualTo(DataAccessLevel.UNREGISTERED);
profile = profileController.submitIdVerification(idVerificationRequest).getBody();
assertThat(profile.getDataAccessLevel()).isEqualTo(DataAccessLevel.REGISTERED);
verify(fireCloudService).addUserToGroup("bob@researchallofus.org", "");
assertThat(profile.getBlockscoreIdVerificationStatus()).isEqualTo(BlockscoreIdVerificationStatus.VERIFIED);
assertThat(profile.getDemographicSurveyCompletionTime()).isEqualTo(NOW.toEpochMilli());
assertThat(profile.getTermsOfServiceCompletionTime()).isEqualTo(NOW.toEpochMilli());
assertThat(profile.getEthicsTrainingCompletionTime()).isEqualTo(NOW.toEpochMilli());
}
use of org.pmiops.workbench.model.Profile in project workbench by all-of-us.
the class ProfileControllerTest method testMe_userBeforeSuccessCloudProjectConflict.
@Test
public void testMe_userBeforeSuccessCloudProjectConflict() throws Exception {
createUser();
when(fireCloudService.isRequesterEnabledInFirecloud()).thenReturn(true);
String projectName = BILLING_PROJECT_PREFIX + user.getUserId();
doThrow(new ApiException(HttpStatus.CONFLICT.value(), "conflict")).when(fireCloudService).createAllOfUsBillingProject(projectName);
doThrow(new ApiException(HttpStatus.CONFLICT.value(), "conflict")).when(fireCloudService).createAllOfUsBillingProject(projectName + "-1");
Profile profile = cloudProfileController.getMe().getBody();
// When a conflict occurs in dev, log the exception but continue.
assertProfile(profile, PRIMARY_EMAIL, CONTACT_EMAIL, FAMILY_NAME, GIVEN_NAME, DataAccessLevel.UNREGISTERED, TIMESTAMP, projectName + "-2", true);
verify(fireCloudService).registerUser(CONTACT_EMAIL, GIVEN_NAME, FAMILY_NAME);
verify(fireCloudService).createAllOfUsBillingProject(projectName);
verify(fireCloudService).createAllOfUsBillingProject(projectName + "-1");
verify(fireCloudService).createAllOfUsBillingProject(projectName + "-2");
verify(fireCloudService).addUserToBillingProject(PRIMARY_EMAIL, projectName + "-2");
}
use of org.pmiops.workbench.model.Profile in project workbench by all-of-us.
the class ProfileControllerTest method testSubmitDemographicSurvey_success.
@Test
public void testSubmitDemographicSurvey_success() throws Exception {
createUser();
Profile profile = profileController.submitDemographicsSurvey().getBody();
assertThat(profile.getDataAccessLevel()).isEqualTo(DataAccessLevel.UNREGISTERED);
assertThat(profile.getBlockscoreIdVerificationStatus()).isEqualTo(BlockscoreIdVerificationStatus.UNVERIFIED);
assertThat(profile.getDemographicSurveyCompletionTime()).isEqualTo(NOW.toEpochMilli());
assertThat(profile.getTermsOfServiceCompletionTime()).isNull();
assertThat(profile.getEthicsTrainingCompletionTime()).isNull();
}
use of org.pmiops.workbench.model.Profile in project workbench by all-of-us.
the class ProfileControllerTest method testSubmitTermsOfService_success.
@Test
public void testSubmitTermsOfService_success() throws Exception {
createUser();
Profile profile = profileController.submitTermsOfService().getBody();
assertThat(profile.getDataAccessLevel()).isEqualTo(DataAccessLevel.UNREGISTERED);
assertThat(profile.getBlockscoreIdVerificationStatus()).isEqualTo(BlockscoreIdVerificationStatus.UNVERIFIED);
assertThat(profile.getDemographicSurveyCompletionTime()).isNull();
assertThat(profile.getTermsOfServiceCompletionTime()).isEqualTo(NOW.toEpochMilli());
assertThat(profile.getEthicsTrainingCompletionTime()).isNull();
}
use of org.pmiops.workbench.model.Profile in project workbench by all-of-us.
the class ProfileControllerTest method testSubmitIdVerification_success.
@Test
public void testSubmitIdVerification_success() throws Exception {
createUser();
when(blockscoreService.createPerson(eq("Bob"), eq(null), any(Address.class), eq(null), eq(null), eq(null))).thenReturn(person);
when(person.getId()).thenReturn("id");
when(person.isValid()).thenReturn(true);
Profile profile = profileController.submitIdVerification(idVerificationRequest).getBody();
assertThat(profile.getDataAccessLevel()).isEqualTo(DataAccessLevel.UNREGISTERED);
assertThat(profile.getBlockscoreIdVerificationStatus()).isEqualTo(BlockscoreIdVerificationStatus.VERIFIED);
assertThat(profile.getDemographicSurveyCompletionTime()).isNull();
assertThat(profile.getTermsOfServiceCompletionTime()).isNull();
assertThat(profile.getEthicsTrainingCompletionTime()).isNull();
}
Aggregations