Search in sources :

Example 6 with WorkbenchConfig

use of org.pmiops.workbench.config.WorkbenchConfig in project workbench by all-of-us.

the class AuthInterceptorTest method setup.

@Before
public void setup() {
    WorkbenchConfig workbenchConfig = new WorkbenchConfig();
    workbenchConfig.googleDirectoryService = new GoogleDirectoryServiceConfig();
    workbenchConfig.googleDirectoryService.gSuiteDomain = "fake-domain.org";
    workbenchConfig.auth = new AuthConfig();
    workbenchConfig.auth.serviceAccountApiUsers = new ArrayList<>();
    workbenchConfig.auth.serviceAccountApiUsers.add("service-account@appspot.gserviceaccount.com");
    this.interceptor = new AuthInterceptor(userInfoService, fireCloudService, Providers.of(workbenchConfig), userDao, userService);
    this.user = new User();
    user.setUserId(USER_ID);
    user.setDisabled(false);
}
Also used : WorkbenchConfig(org.pmiops.workbench.config.WorkbenchConfig) User(org.pmiops.workbench.db.model.User) AuthConfig(org.pmiops.workbench.config.WorkbenchConfig.AuthConfig) GoogleDirectoryServiceConfig(org.pmiops.workbench.config.WorkbenchConfig.GoogleDirectoryServiceConfig) Before(org.junit.Before)

Example 7 with WorkbenchConfig

use of org.pmiops.workbench.config.WorkbenchConfig 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)

Example 8 with WorkbenchConfig

use of org.pmiops.workbench.config.WorkbenchConfig in project workbench by all-of-us.

the class DirectoryServiceImplIntegrationTest method createConfig.

private static WorkbenchConfig createConfig() {
    WorkbenchConfig config = new WorkbenchConfig();
    config.googleDirectoryService = new WorkbenchConfig.GoogleDirectoryServiceConfig();
    config.googleDirectoryService.gSuiteDomain = "fake-research-aou.org";
    return config;
}
Also used : WorkbenchConfig(org.pmiops.workbench.config.WorkbenchConfig)

Aggregations

WorkbenchConfig (org.pmiops.workbench.config.WorkbenchConfig)8 Before (org.junit.Before)2 FireCloudConfig (org.pmiops.workbench.config.WorkbenchConfig.FireCloudConfig)2 User (org.pmiops.workbench.db.model.User)2 ApiException (org.pmiops.workbench.firecloud.ApiException)2 Profile (org.pmiops.workbench.model.Profile)2 Address (com.blockscore.models.Address)1 HttpResponseException (com.google.api.client.http.HttpResponseException)1 Userinfoplus (com.google.api.services.oauth2.model.Userinfoplus)1 ApiOperation (io.swagger.annotations.ApiOperation)1 Authorization (io.swagger.annotations.Authorization)1 Test (org.junit.Test)1 ProfileService (org.pmiops.workbench.auth.ProfileService)1 UserAuthentication (org.pmiops.workbench.auth.UserAuthentication)1 AuthConfig (org.pmiops.workbench.config.WorkbenchConfig.AuthConfig)1 GoogleDirectoryServiceConfig (org.pmiops.workbench.config.WorkbenchConfig.GoogleDirectoryServiceConfig)1 WorkbenchEnvironment (org.pmiops.workbench.config.WorkbenchEnvironment)1 UserService (org.pmiops.workbench.db.dao.UserService)1 ForbiddenException (org.pmiops.workbench.exceptions.ForbiddenException)1 ServerErrorException (org.pmiops.workbench.exceptions.ServerErrorException)1