use of org.pmiops.workbench.config.WorkbenchConfig.FireCloudConfig in project workbench by all-of-us.
the class ProfileControllerTest method setUp.
@Before
public void setUp() {
WorkbenchConfig config = new WorkbenchConfig();
config.firecloud = new FireCloudConfig();
config.firecloud.billingProjectPrefix = BILLING_PROJECT_PREFIX;
WorkbenchEnvironment environment = new WorkbenchEnvironment(true, "appId");
WorkbenchEnvironment cloudEnvironment = new WorkbenchEnvironment(false, "appId");
createAccountRequest = new CreateAccountRequest();
invitationVerificationRequest = new InvitationVerificationRequest();
Profile profile = new Profile();
profile.setContactEmail(CONTACT_EMAIL);
profile.setFamilyName(FAMILY_NAME);
profile.setGivenName(GIVEN_NAME);
profile.setUsername(USERNAME);
createAccountRequest.setProfile(profile);
createAccountRequest.setInvitationKey(INVITATION_KEY);
createAccountRequest.setPassword(PASSWORD);
invitationVerificationRequest.setInvitationKey(INVITATION_KEY);
googleUser = new com.google.api.services.admin.directory.model.User();
googleUser.setPrimaryEmail(PRIMARY_EMAIL);
clock = new FakeClock(NOW);
idVerificationRequest = new IdVerificationRequest();
idVerificationRequest.setFirstName("Bob");
UserService userService = new UserService(userProvider, userDao, adminActionHistoryDao, clock, fireCloudService, configProvider);
ProfileService profileService = new ProfileService(fireCloudService, mailChimpService, userDao);
this.profileController = new ProfileController(profileService, userProvider, userAuthenticationProvider, userDao, clock, userService, fireCloudService, directoryService, cloudStorageService, blockscoreService, mailChimpService, Providers.of(config), environment);
this.cloudProfileController = new ProfileController(profileService, userProvider, userAuthenticationProvider, userDao, clock, userService, fireCloudService, directoryService, cloudStorageService, blockscoreService, mailChimpService, Providers.of(config), cloudEnvironment);
}
use of org.pmiops.workbench.config.WorkbenchConfig.FireCloudConfig 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());
}
Aggregations