From 48a3d31f130bc65eb456ad1ae2d30be8861ad1d1 Mon Sep 17 00:00:00 2001 From: Yasasr1 Date: Tue, 10 Dec 2024 09:38:51 +0530 Subject: [PATCH] Fix test failure. --- .../OrganizationDiscoveryTestCase.java | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/organizationDiscovery/OrganizationDiscoveryTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/organizationDiscovery/OrganizationDiscoveryTestCase.java index 8a025c6557..9177f9e238 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/organizationDiscovery/OrganizationDiscoveryTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/organizationDiscovery/OrganizationDiscoveryTestCase.java @@ -45,6 +45,7 @@ import org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager; import org.wso2.identity.integration.test.oauth2.OAuth2ServiceAbstractIntegrationTest; import org.wso2.identity.integration.test.oauth2.dataprovider.model.ApplicationConfig; +import org.wso2.identity.integration.test.oauth2.dataprovider.model.UserClaimConfig; import org.wso2.identity.integration.test.rest.api.common.RESTTestBase; import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.ApplicationResponseModel; import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.ApplicationSharePOSTRequest; @@ -106,7 +107,7 @@ public class OrganizationDiscoveryTestCase extends OAuth2ServiceAbstractIntegrat private OAuth2RestClient oAuth2RestClient; private OrgMgtRestClient orgMgtRestClient; - @BeforeClass(alwaysRun = true) + @BeforeClass(dependsOnGroups = "wso2.is", alwaysRun = true) public void testInit() throws Exception { super.init(); @@ -131,8 +132,13 @@ protected boolean isRedirectable(String method) { } }).build(); + List userClaimConfigs = Collections.singletonList( + new UserClaimConfig.Builder().localClaimUri("http://wso2.org/claims/emailaddress").oidcClaimUri("email") + .build()); + // Create an application. ApplicationConfig applicationConfig = new ApplicationConfig.Builder() + .claimsList(userClaimConfigs) .grantTypes(new ArrayList<>(Collections.singleton(OAUTH2_GRANT_TYPE_AUTHORIZATION_CODE))) .tokenType(ApplicationConfig.TokenType.OPAQUE) .expiryTime(3600) @@ -165,7 +171,7 @@ protected boolean isRedirectable(String method) { organizationDiscoveryConfigRestClient.mapDiscoveryAttributes(subOrgId, mapEmailDomainRequestBody); } - @Test(description = "Test email domain based organization discovery not initiated " + + @Test(dependsOnGroups = "wso2.is", description = "Test email domain based organization discovery not initiated " + "for unshared app", priority = 1) public void testSelfRegistrationOrgDiscoveryForUnsharedApp() throws Exception { @@ -182,7 +188,9 @@ public void testSelfRegistrationOrgDiscoveryForUnsharedApp() throws Exception { "Should not be redirected to domain discovery page for an unshared app."); } - @Test(description = "Test email domain based organization discovery for self-registration", priority = 2) + @Test(dependsOnGroups = "wso2.is", dependsOnMethods = "testSelfRegistrationOrgDiscoveryForUnsharedApp", + description = "Test email domain based organization discovery for self-registration", + priority = 2) public void testSelfRegistrationOrgDiscovery() throws Exception { // Share the app @@ -222,8 +230,9 @@ public void testSelfRegistrationOrgDiscovery() throws Exception { EntityUtils.consume(response.getEntity()); } - @Test(description = "Test email domain based organization discovery for self-registration with an " + - "invalid email domain", priority = 3) + @Test(dependsOnGroups = "wso2.is", + description = "Test email domain based organization discovery for self-registration with an " + + "invalid email domain", priority = 3) public void testSelfRegistrationOrgDiscoveryWithInvalidEmail() throws Exception { // Initiate the authorize request to get the login page and retrieve the session data key. @@ -255,8 +264,8 @@ public void testSelfRegistrationOrgDiscoveryWithInvalidEmail() throws Exception EntityUtils.consume(response.getEntity()); } - @AfterClass(alwaysRun = true) - public void testClear() throws Exception { + @AfterClass(dependsOnGroups = "wso2.is", alwaysRun = true) + public void atEnd() throws Exception { organizationDiscoveryConfigRestClient.deleteOrganizationDiscoveryConfig(); deleteApp(application.getId());