Search in sources :

Example 6 with TestUser

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

the class UserAdministrationScenario2IntTest method anynmouse_can_NOT_revoke_user_admin_rights.

@Test
public void anynmouse_can_NOT_revoke_user_admin_rights() {
    /* prepare */
    TestUser adminUser = USER_2;
    as(SUPER_ADMIN).grantSuperAdminRightsTo(adminUser);
    assertUser(adminUser).isSuperAdmin();
    /* execute + test */
    assertUser(ANONYMOUS).canNotRevokeSuperAdminRightsFrom(adminUser, HttpStatus.UNAUTHORIZED);
}
Also used : TestUser(com.mercedesbenz.sechub.integrationtest.api.TestUser) Test(org.junit.Test)

Example 7 with TestUser

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

the class ProjectMockConfigurationScenario2IntTest method a_user_can_change_mock_configuration_and_behavior.

/* ------------------------------------------------ */
/* -----------------Adapter behaviour ------------- */
/* ------------------------------------------------ */
/* @formatter:off */
@Test
public void a_user_can_change_mock_configuration_and_behavior() {
    TestUser user = USER_1;
    TestProject project = PROJECT_1;
    /* Step1: prepare */
    as(SUPER_ADMIN).assignUserToProject(user, project).updateWhiteListForProject(project, Arrays.asList(IntegrationTestExampleConstants.INFRASCAN_DEFAULT_WHITELEIST_ENTRY, MockData.NETSPARKER_RED_ZERO_WAIT.getTarget()));
    /* test web scan yellow */
    as(user).setProjectMockConfiguration(project, createMockScanConfig("webScan", TrafficLight.YELLOW));
    assertResult(as(user).createWebScanAndFetchScanData(project)).isYellow();
    /* test web scan green */
    as(user).setProjectMockConfiguration(project, createMockScanConfig("webScan", TrafficLight.GREEN));
    assertResult(as(user).createWebScanAndFetchScanData(project)).isGreen();
    /* test code scan red */
    as(user).setProjectMockConfiguration(project, createMockScanConfig("codeScan", TrafficLight.RED));
    assertResult(as(user).withSecHubClient().startAndWaitForCodeScan(project)).isRed();
    /* test infra scan green */
    as(user).setProjectMockConfiguration(project, createMockScanConfig("infraScan", TrafficLight.GREEN));
    assertResult(as(user).withSecHubClient().createInfraScanAndFetchScanData(project)).isGreen();
}
Also used : TestProject(com.mercedesbenz.sechub.integrationtest.api.TestProject) TestUser(com.mercedesbenz.sechub.integrationtest.api.TestUser) Test(org.junit.Test)

Example 8 with TestUser

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

the class AbstractSecHubServerTestScenario method cleanupAllTestUsers.

protected void cleanupAllTestUsers() {
    List<TestUser> testusers = getTestUsers(getClass());
    LOG.debug("CLEANUP all test uses");
    for (TestUser user : testusers) {
        LOG.debug("Drop user:{}", user);
        resetUserInstanceData(user);
        dropExistingUser(user);
        dropExistingSignups(user);
    }
}
Also used : TestUser(com.mercedesbenz.sechub.integrationtest.api.TestUser)

Example 9 with TestUser

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

the class AbstractSecHubServerTestScenario method createTestUser.

/**
 * Create a test user <b>instance</b> inside a scenario. But will not create the
 * real user on database etc. This is only the definition for a scenario. The
 * scenario itself will cleanup and handle the test user instance!
 *
 * @param clazz
 * @param userIdPart
 * @return
 */
protected static TestUser createTestUser(Class<? extends AbstractSecHubServerTestScenario> clazz, String userIdPart) {
    TestUser testUser = new TestUser(userIdPart, null);
    List<TestUser> testUsers = getTestUsers(clazz);
    testUsers.add(testUser);
    return testUser;
}
Also used : TestUser(com.mercedesbenz.sechub.integrationtest.api.TestUser)

Example 10 with TestUser

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

the class AbstractSecHubServerTestScenario method prepareTestData.

public void prepareTestData() {
    List<TestUser> testUsers = getTestUsers(getClass());
    for (TestUser user : testUsers) {
        LOG.debug("recalculate user:{}", user);
        user.prepare(this);
    }
    List<TestProject> testProjects = getTestProjects(getClass());
    for (TestProject project : testProjects) {
        LOG.debug("recalculate project:{}", project);
        project.prepare(this);
    }
}
Also used : TestProject(com.mercedesbenz.sechub.integrationtest.api.TestProject) TestUser(com.mercedesbenz.sechub.integrationtest.api.TestUser)

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