Search in sources :

Example 1 with FireCloudConfig

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);
}
Also used : WorkbenchConfig(org.pmiops.workbench.config.WorkbenchConfig) FireCloudConfig(org.pmiops.workbench.config.WorkbenchConfig.FireCloudConfig) UserService(org.pmiops.workbench.db.dao.UserService) FakeClock(org.pmiops.workbench.test.FakeClock) InvitationVerificationRequest(org.pmiops.workbench.model.InvitationVerificationRequest) Profile(org.pmiops.workbench.model.Profile) CreateAccountRequest(org.pmiops.workbench.model.CreateAccountRequest) ProfileService(org.pmiops.workbench.auth.ProfileService) IdVerificationRequest(org.pmiops.workbench.model.IdVerificationRequest) WorkbenchEnvironment(org.pmiops.workbench.config.WorkbenchEnvironment) Before(org.junit.Before)

Example 2 with FireCloudConfig

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());
}
Also used : WorkbenchConfig(org.pmiops.workbench.config.WorkbenchConfig) Address(com.blockscore.models.Address) FireCloudConfig(org.pmiops.workbench.config.WorkbenchConfig.FireCloudConfig) Profile(org.pmiops.workbench.model.Profile) DataJpaTest(org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest) Test(org.junit.Test)

Aggregations

WorkbenchConfig (org.pmiops.workbench.config.WorkbenchConfig)2 FireCloudConfig (org.pmiops.workbench.config.WorkbenchConfig.FireCloudConfig)2 Profile (org.pmiops.workbench.model.Profile)2 Address (com.blockscore.models.Address)1 Before (org.junit.Before)1 Test (org.junit.Test)1 ProfileService (org.pmiops.workbench.auth.ProfileService)1 WorkbenchEnvironment (org.pmiops.workbench.config.WorkbenchEnvironment)1 UserService (org.pmiops.workbench.db.dao.UserService)1 CreateAccountRequest (org.pmiops.workbench.model.CreateAccountRequest)1 IdVerificationRequest (org.pmiops.workbench.model.IdVerificationRequest)1 InvitationVerificationRequest (org.pmiops.workbench.model.InvitationVerificationRequest)1 FakeClock (org.pmiops.workbench.test.FakeClock)1 DataJpaTest (org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest)1