Search in sources :

Example 1 with TestProject

use of com.mercedesbenz.sechub.integrationtest.api.TestProject in project sechub by mercedes-benz.

the class SecHubExecutionScenarioSecHubClientIntTest method sechub_client_can_execute_a_config_file_which_uses_template_variables_of_environment_entries.

// we use startDownloadJobReport here - old implementation okay here
@SuppressWarnings("deprecation")
@Test
public void sechub_client_can_execute_a_config_file_which_uses_template_variables_of_environment_entries() {
    /* @formatter:off */
    /* prepare */
    TestProject project = PROJECT_3;
    TestUser user = USER_1;
    assertProject(project).hasNoWhiteListEntries();
    List<String> list = new ArrayList<>();
    as(SUPER_ADMIN).updateWhiteListForProject(project, list).assignUserToProject(user, project);
    Map<String, String> envEntries = new LinkedHashMap<>();
    envEntries.put("SHTEST_VERSION", "1.0");
    envEntries.put("SHTEST_FOLDERS1", IntegrationTestMockMode.CODE_SCAN__CHECKMARX__GREEN__FAST.getTarget());
    /* execute */
    IntegrationTestJSONLocation location = CLIENT_JSON_SOURCESCAN_GENERIC_TEMPLATE;
    UUID jobUUID = as(user).withSecHubClient().startAsynchronScanFor(project, location, envEntries).assertFileUploaded(project).assertJobTriggered().getJobUUID();
    waitForJobDoneAndFailWhenJobIsFailing(project, jobUUID);
    /* why test green result ? Because we set test folders in a way we
		 * will expect green traffic light - which is only the case when
		 * we have an explicit path set by the environment entry inside
		 * template... We could also rely on server validation of version
		 * but this way is better, because we rely on test environment /mocked
		 * adapter behavior which is well known.
		 */
    as(user).withSecHubClient().startDownloadJobReport(project, jobUUID, location).hasTrafficLight(TrafficLight.GREEN);
/* @formatter:on */
}
Also used : TestProject(com.mercedesbenz.sechub.integrationtest.api.TestProject) IntegrationTestJSONLocation(com.mercedesbenz.sechub.integrationtest.api.IntegrationTestJSONLocation) ArrayList(java.util.ArrayList) UUID(java.util.UUID) TestUser(com.mercedesbenz.sechub.integrationtest.api.TestUser) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test)

Example 2 with TestProject

use of com.mercedesbenz.sechub.integrationtest.api.TestProject in project sechub by mercedes-benz.

the class ProjectChangeAccessLevelScenario3IntTest method none___user_1_cannot_create_new_job.

/* @formatter:on */
/* @formatter:off */
@Test
public void none___user_1_cannot_create_new_job() throws Exception {
    /* prepare + test preconditions */
    TestProject project = PROJECT_1;
    /* execute */
    as(SUPER_ADMIN).changeProjectAccessLevel(project, ProjectAccessLevel.NONE);
    /* test */
    expectHttpFailure(() -> {
        as(USER_1).createWebScan(project);
    }, HttpStatus.FORBIDDEN);
}
Also used : TestProject(com.mercedesbenz.sechub.integrationtest.api.TestProject) Test(org.junit.Test)

Example 3 with TestProject

use of com.mercedesbenz.sechub.integrationtest.api.TestProject in project sechub by mercedes-benz.

the class ProjectChangeAccessLevelScenario3IntTest method admin_changes_project_state_to_no_access_project_details_contains_the_information.

/* @formatter:on */
/* @formatter:off */
@Test
public void admin_changes_project_state_to_no_access_project_details_contains_the_information() throws Exception {
    /* prepare + test preconditions */
    TestProject project = PROJECT_1;
    /* execute */
    as(SUPER_ADMIN).changeProjectAccessLevel(project, ProjectAccessLevel.NONE);
    /* test */
    assertProject(project).hasAccessLevel(ProjectAccessLevel.NONE);
}
Also used : TestProject(com.mercedesbenz.sechub.integrationtest.api.TestProject) Test(org.junit.Test)

Example 4 with TestProject

use of com.mercedesbenz.sechub.integrationtest.api.TestProject in project sechub by mercedes-benz.

the class ProjectChangeAccessLevelScenario3IntTest method read_only___user_1_cannot_approve_existing_job.

/* @formatter:on */
/* @formatter:off */
@Test
public void read_only___user_1_cannot_approve_existing_job() throws Exception {
    /* prepare + test preconditions */
    TestProject project = PROJECT_1;
    UUID jobUUID = as(USER_1).createWebScan(project);
    /* execute */
    as(SUPER_ADMIN).changeProjectAccessLevel(project, ProjectAccessLevel.READ_ONLY);
    /* test */
    expectHttpFailure(() -> {
        as(USER_1).approveJob(project, jobUUID);
    }, HttpStatus.FORBIDDEN);
}
Also used : TestProject(com.mercedesbenz.sechub.integrationtest.api.TestProject) UUID(java.util.UUID) Test(org.junit.Test)

Example 5 with TestProject

use of com.mercedesbenz.sechub.integrationtest.api.TestProject in project sechub by mercedes-benz.

the class ProjectChangeAccessLevelScenario3IntTest method none___user_1_cannot_approve_existing_job.

/* @formatter:on */
/* @formatter:off */
@Test
public void none___user_1_cannot_approve_existing_job() throws Exception {
    /* prepare + test preconditions */
    TestProject project = PROJECT_1;
    UUID jobUUID = as(USER_1).createWebScan(project);
    /* execute */
    as(SUPER_ADMIN).changeProjectAccessLevel(project, ProjectAccessLevel.NONE);
    /* test */
    expectHttpFailure(() -> {
        as(USER_1).approveJob(project, jobUUID);
    }, HttpStatus.FORBIDDEN);
}
Also used : TestProject(com.mercedesbenz.sechub.integrationtest.api.TestProject) UUID(java.util.UUID) Test(org.junit.Test)

Aggregations

TestProject (com.mercedesbenz.sechub.integrationtest.api.TestProject)43 Test (org.junit.Test)35 UUID (java.util.UUID)27 TestUser (com.mercedesbenz.sechub.integrationtest.api.TestUser)11 IntegrationTestJSONLocation (com.mercedesbenz.sechub.integrationtest.api.IntegrationTestJSONLocation)10 ExecutionResult (com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult)4 LinkedHashMap (java.util.LinkedHashMap)4 TestExecutionProfile (com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfile)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 SecHubScanConfiguration (com.mercedesbenz.sechub.commons.model.SecHubScanConfiguration)2 ListExecutionProfilesDialogUI (com.mercedesbenz.sechub.developertools.admin.ui.action.config.ListExecutionProfilesDialogUI)2 JSonMessageHttpStatusExceptionTestValidator (com.mercedesbenz.sechub.integrationtest.api.JSonMessageHttpStatusExceptionTestValidator)2 File (java.io.File)2 SecHubWebScanConfiguration (com.mercedesbenz.sechub.commons.model.SecHubWebScanConfiguration)1 AbstractTestExecutable (com.mercedesbenz.sechub.integrationtest.api.AbstractTestExecutable)1 AssertFullScanData (com.mercedesbenz.sechub.integrationtest.api.AssertFullScanData)1 FullScanDataElement (com.mercedesbenz.sechub.integrationtest.api.AssertFullScanData.FullScanDataElement)1 WithSecHubClient (com.mercedesbenz.sechub.integrationtest.api.WithSecHubClient)1 TestExecutorConfig (com.mercedesbenz.sechub.test.executorconfig.TestExecutorConfig)1