Search in sources :

Example 16 with TestUser

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

the class SecHubExecutionScenarioSecHubClientIntTest method a_project_having_no_white_list_entries_but_some_problems_can_be_executed_as_codescan_and_results_yellow.

// we use startDownloadJobReport here - old implementation okay here
@SuppressWarnings("deprecation")
@Test
public void a_project_having_no_white_list_entries_but_some_problems_can_be_executed_as_codescan_and_results_yellow() {
    /* @formatter:off */
    /* prepare */
    TestProject project = PROJECT_3;
    TestUser user = USER_1;
    assertProject(project).hasNoWhiteListEntries();
    as(SUPER_ADMIN).assignUserToProject(user, project);
    /* execute */
    IntegrationTestJSONLocation location = CLIENT_JSON_SOURCESCAN_YELLOW_ZERO_WAIT;
    UUID jobUUID = as(user).withSecHubClient().startAsynchronScanFor(project, location).assertFileUploaded(project).assertJobTriggered().getJobUUID();
    waitForJobDoneAndFailWhenJobIsFailing(project, jobUUID);
    as(user).withSecHubClient().startDownloadJobReport(project, jobUUID, location).hasTrafficLight(TrafficLight.YELLOW);
/* @formatter:on */
}
Also used : TestProject(com.mercedesbenz.sechub.integrationtest.api.TestProject) IntegrationTestJSONLocation(com.mercedesbenz.sechub.integrationtest.api.IntegrationTestJSONLocation) UUID(java.util.UUID) TestUser(com.mercedesbenz.sechub.integrationtest.api.TestUser) Test(org.junit.Test)

Example 17 with TestUser

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

the class SecHubExecutionScenarioSecHubClientIntTest method a_project_having_metadata_no_problems_can_be_executed_as_codescan_and_results_green.

// we use startDownloadJobReport here - old implementation okay here
@SuppressWarnings("deprecation")
@Test
public void a_project_having_metadata_no_problems_can_be_executed_as_codescan_and_results_green() {
    /* @formatter:off */
    /* prepare */
    TestProject project = PROJECT_3;
    TestUser user = USER_1;
    assertProject(project).hasNoMetaData();
    Map<String, String> metaData = new HashMap<>();
    metaData.put("key1", "value1");
    as(SUPER_ADMIN).assignUserToProject(user, project).updateMetaDataForProject(project, metaData);
    assertProject(project).hasMetaData(metaData);
    /* execute */
    IntegrationTestJSONLocation location = CLIENT_JSON_SOURCESCAN_GREEN_ZERO_WAIT;
    UUID jobUUID = as(user).withSecHubClient().startAsynchronScanFor(project, location).assertFileUploaded(project).assertJobTriggered().getJobUUID();
    waitForJobDoneAndFailWhenJobIsFailing(project, jobUUID);
    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) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) UUID(java.util.UUID) TestUser(com.mercedesbenz.sechub.integrationtest.api.TestUser) Test(org.junit.Test)

Example 18 with TestUser

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

the class SecHubExecutionScenarioSecHubClientIntTest method a_project_having_no_problems_can_be_executed_as_codescan_and_results_green.

// we use startDownloadJobReport here - old implementation okay here
@SuppressWarnings("deprecation")
@Test
public void a_project_having_no_problems_can_be_executed_as_codescan_and_results_green() {
    /* @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);
    /* execute */
    IntegrationTestJSONLocation location = CLIENT_JSON_SOURCESCAN_GREEN_ZERO_WAIT;
    UUID jobUUID = as(user).withSecHubClient().startAsynchronScanFor(project, location).assertFileUploaded(project).assertJobTriggered().getJobUUID();
    waitForJobDoneAndFailWhenJobIsFailing(project, jobUUID);
    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) Test(org.junit.Test)

Example 19 with TestUser

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

the class UserAdministrationScenario2IntTest method superadmin_can_grant_user_admin_rights_mails_are_sent_and_user_appears_as_expected_then.

/* +-----------------------------------------------------------------------+ */
/* +............................ User ......... ...........................+ */
/* +-----------------------------------------------------------------------+ */
/* @formatter:off */
@Test
public void superadmin_can_grant_user_admin_rights_mails_are_sent_and_user_appears_as_expected_then() {
    TestUser userBecomingAdmin = USER_1;
    /* execute grant +test */
    assertUser(SUPER_ADMIN).canGrantSuperAdminRightsTo(userBecomingAdmin);
    /* test behavior*/
    assertUser(userBecomingAdmin).isSuperAdmin().isInSuperAdminList();
    /* test notifications */
    assertUser(userBecomingAdmin).hasReceivedEmail("SecHub administrator privileges granted");
    assertMailExists("int-test_superadmins_npm@example.org", "SecHub: Granted administrator rights.*" + userBecomingAdmin.getUserId(), TextSearchMode.REGULAR_EXPRESSON);
}
Also used : TestUser(com.mercedesbenz.sechub.integrationtest.api.TestUser) Test(org.junit.Test)

Example 20 with TestUser

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

the class UserAdministrationScenario2IntTest method superadmin_can_revoke_user_admin_rights.

/* @formatter:off */
@Test
public void superadmin_can_revoke_user_admin_rights() {
    /* prepare */
    TestUser userNoMoreAdmin = USER_2;
    as(SUPER_ADMIN).grantSuperAdminRightsTo(userNoMoreAdmin);
    assertUser(userNoMoreAdmin).isSuperAdmin();
    /* execute + test */
    assertUser(SUPER_ADMIN).canRevokeSuperAdminRightsTo(userNoMoreAdmin);
    /* test behavior*/
    assertUser(userNoMoreAdmin).isNotSuperAdmin().isNotInSuperAdminList();
    /* test notifications */
    assertUser(userNoMoreAdmin).hasReceivedEmail("SecHub administrator privileges revoked");
    assertMailExists("int-test_superadmins_npm@example.org", "SecHub: Revoked administrator rights.*" + userNoMoreAdmin.getUserId(), TextSearchMode.REGULAR_EXPRESSON);
}
Also used : TestUser(com.mercedesbenz.sechub.integrationtest.api.TestUser) Test(org.junit.Test)

Aggregations

TestUser (com.mercedesbenz.sechub.integrationtest.api.TestUser)20 Test (org.junit.Test)16 TestProject (com.mercedesbenz.sechub.integrationtest.api.TestProject)11 UUID (java.util.UUID)9 IntegrationTestJSONLocation (com.mercedesbenz.sechub.integrationtest.api.IntegrationTestJSONLocation)8 LinkedHashMap (java.util.LinkedHashMap)4 ArrayList (java.util.ArrayList)3 AnonymousTestUser (com.mercedesbenz.sechub.integrationtest.api.AnonymousTestUser)2 HashMap (java.util.HashMap)2 AssertFullScanData (com.mercedesbenz.sechub.integrationtest.api.AssertFullScanData)1 FullScanDataElement (com.mercedesbenz.sechub.integrationtest.api.AssertFullScanData.FullScanDataElement)1 FixedTestUser (com.mercedesbenz.sechub.integrationtest.api.FixedTestUser)1 ExecutionResult (com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult)1 File (java.io.File)1