Search in sources :

Example 1 with AnonymousTestUser

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

the class SecHubExecutionScenario2IntTest method when_user_exists_user_cannot_be_signed_in_again.

@Test
public void when_user_exists_user_cannot_be_signed_in_again() {
    /* @formatter:off */
    assertUser(USER_1).doesExist();
    /* already created */
    // signup is not existing
    assertSignup(USER_1).doesNotExist();
    TestUser newUser = new AnonymousTestUser(USER_1.getUserId(), "somewhere." + System.currentTimeMillis() + "@example.org");
    /* execute + test */
    expectHttpFailure(() -> as(ANONYMOUS).signUpAs(newUser), HttpStatus.NOT_ACCEPTABLE);
/* @formatter:on */
}
Also used : AnonymousTestUser(com.mercedesbenz.sechub.integrationtest.api.AnonymousTestUser) AnonymousTestUser(com.mercedesbenz.sechub.integrationtest.api.AnonymousTestUser) TestUser(com.mercedesbenz.sechub.integrationtest.api.TestUser) Test(org.junit.Test)

Example 2 with AnonymousTestUser

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

the class SecHubExecutionScenario2IntTest method when_another_user_has_got_the_email_used_for_signup_but_different_name_user_cannot_be_signed_in_again.

@Test
public void when_another_user_has_got_the_email_used_for_signup_but_different_name_user_cannot_be_signed_in_again() {
    /* @formatter:off */
    assertUser(USER_1).doesExist();
    /* already created */
    String name = "u_" + System.currentTimeMillis();
    if (name.length() > 15 || name.length() < 5) {
        throw new IllegalStateException("testcase corrupt - name invalid:" + name + ". Testcase checks only for same email recognized. Name must be correct here!");
    }
    TestUser newUser = new AnonymousTestUser(name, USER_1.getEmail());
    /* execute + test */
    expectHttpFailure(() -> as(ANONYMOUS).signUpAs(newUser), HttpStatus.NOT_ACCEPTABLE);
/* @formatter:on */
}
Also used : AnonymousTestUser(com.mercedesbenz.sechub.integrationtest.api.AnonymousTestUser) AnonymousTestUser(com.mercedesbenz.sechub.integrationtest.api.AnonymousTestUser) TestUser(com.mercedesbenz.sechub.integrationtest.api.TestUser) Test(org.junit.Test)

Aggregations

AnonymousTestUser (com.mercedesbenz.sechub.integrationtest.api.AnonymousTestUser)2 TestUser (com.mercedesbenz.sechub.integrationtest.api.TestUser)2 Test (org.junit.Test)2