From 1a68b49f2ce307e31df1d4ae4f0e8228c3f27cde Mon Sep 17 00:00:00 2001 From: ZiyamSanthosh Date: Mon, 29 Jan 2024 13:34:58 +0530 Subject: [PATCH 1/2] Change test execution order --- .../selfRegister/SelfRegisterTestCase.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/selfRegister/SelfRegisterTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/selfRegister/SelfRegisterTestCase.java index e876957a8ae..3d438b6c192 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/selfRegister/SelfRegisterTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/selfRegister/SelfRegisterTestCase.java @@ -90,16 +90,6 @@ public void testSelfRegisterWithExistingUsername() throws Exception { Assert.assertEquals(responseOfPost.statusCode(), HttpStatus.SC_CONFLICT, "Self register user already exists"); } - @Test(alwaysRun = true, groups = "wso2.is", description = "Create self registered user with invalid username") - public void testSelfRegisterWithInvalidUsername() throws Exception { - - updateResidentIDPProperty(ENABLE_SELF_SIGN_UP, "true", true); - String selfRegisterUserInfoWithInvalidUsername = selfRegisterUserInfo.replaceAll("selfRegisterTestUser", "ab"); - Response responseOfPost = - getResponseOfPost(SELF_REGISTRATION_ENDPOINT, selfRegisterUserInfoWithInvalidUsername); - Assert.assertEquals(responseOfPost.statusCode(), HttpStatus.SC_BAD_REQUEST, "Self register username invalid"); - } - @Test(alwaysRun = true, groups = "wso2.is", description = "Create self registered user with invalid password") public void testSelfRegisterWithInvalidPassword() throws Exception { @@ -110,4 +100,14 @@ public void testSelfRegisterWithInvalidPassword() throws Exception { Assert.assertEquals(responseOfPost.statusCode(), HttpStatus.SC_BAD_REQUEST, "Self register user password invalid"); } + + @Test(alwaysRun = true, groups = "wso2.is", description = "Create self registered user with invalid username") + public void testSelfRegisterWithInvalidUsername() throws Exception { + + updateResidentIDPProperty(ENABLE_SELF_SIGN_UP, "true", true); + String selfRegisterUserInfoWithInvalidUsername = selfRegisterUserInfo.replaceAll("selfRegisterTestUser", "ab"); + Response responseOfPost = + getResponseOfPost(SELF_REGISTRATION_ENDPOINT, selfRegisterUserInfoWithInvalidUsername); + Assert.assertEquals(responseOfPost.statusCode(), HttpStatus.SC_BAD_REQUEST, "Self register username invalid"); + } } From 79277379c526def8a2b946dd48fa125d907e9a3d Mon Sep 17 00:00:00 2001 From: ZiyamSanthosh Date: Mon, 29 Jan 2024 13:37:55 +0530 Subject: [PATCH 2/2] Redefine test order --- .../selfRegister/SelfRegisterTestCase.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/selfRegister/SelfRegisterTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/selfRegister/SelfRegisterTestCase.java index 3d438b6c192..823787d43e3 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/selfRegister/SelfRegisterTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/selfRegister/SelfRegisterTestCase.java @@ -69,6 +69,17 @@ public void testSelfRegisterBeforeEnable() throws Exception { Assert.assertEquals(responseOfPost.statusCode(), HttpStatus.SC_BAD_REQUEST, "Self register user not enabled"); } + @Test(alwaysRun = true, groups = "wso2.is", description = "Create self registered user with invalid password") + public void testSelfRegisterWithInvalidPassword() throws Exception { + + updateResidentIDPProperty(ENABLE_SELF_SIGN_UP, "true", true); + String selfRegisterUserInfoWithInvalidPassword = selfRegisterUserInfo.replaceAll("Password12!", "123"); + Response responseOfPost = + getResponseOfPost(SELF_REGISTRATION_ENDPOINT, selfRegisterUserInfoWithInvalidPassword); + Assert.assertEquals(responseOfPost.statusCode(), HttpStatus.SC_BAD_REQUEST, + "Self register user password invalid"); + } + @Test(alwaysRun = true, groups = "wso2.is", description = "Create self registered user") public void testSelfRegister() throws Exception { @@ -90,17 +101,6 @@ public void testSelfRegisterWithExistingUsername() throws Exception { Assert.assertEquals(responseOfPost.statusCode(), HttpStatus.SC_CONFLICT, "Self register user already exists"); } - @Test(alwaysRun = true, groups = "wso2.is", description = "Create self registered user with invalid password") - public void testSelfRegisterWithInvalidPassword() throws Exception { - - updateResidentIDPProperty(ENABLE_SELF_SIGN_UP, "true", true); - String selfRegisterUserInfoWithInvalidPassword = selfRegisterUserInfo.replaceAll("Password12!", "123"); - Response responseOfPost = - getResponseOfPost(SELF_REGISTRATION_ENDPOINT, selfRegisterUserInfoWithInvalidPassword); - Assert.assertEquals(responseOfPost.statusCode(), HttpStatus.SC_BAD_REQUEST, - "Self register user password invalid"); - } - @Test(alwaysRun = true, groups = "wso2.is", description = "Create self registered user with invalid username") public void testSelfRegisterWithInvalidUsername() throws Exception {