From 5c5bb31b16f4b1e7e87c251979be13ca2e554245 Mon Sep 17 00:00:00 2001 From: dewniMW Date: Tue, 31 Oct 2023 20:21:00 +0530 Subject: [PATCH] Add changes to add and delete app --- .../v1/OrganizationManagementSuccessTest.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/organization/management/v1/OrganizationManagementSuccessTest.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/organization/management/v1/OrganizationManagementSuccessTest.java index 4c2cc4e7eba..79be90f2e33 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/organization/management/v1/OrganizationManagementSuccessTest.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/organization/management/v1/OrganizationManagementSuccessTest.java @@ -88,6 +88,7 @@ public class OrganizationManagementSuccessTest extends OrganizationManagementBas private String consumerKey; private String consumerSecret; private String orgSwitchedToken; + private String applicationId; private static final String SYSTEM_SCOPE = "SYSTEM"; @Factory(dataProvider = "restAPIUserConfigProvider") @@ -98,9 +99,12 @@ public OrganizationManagementSuccessTest(TestUserMode userMode, OrganizationLeve } @BeforeClass(alwaysRun = true) - private void testInit() { + private void testInit() throws Exception { oAuth2RestClient = new OAuth2RestClient(serverURL, tenantInfo); + if (organizationLevel == OrganizationLevel.SUB_ORGANIZATION) { + applicationId = addApplication(); + } } @AfterClass(alwaysRun = true) @@ -108,6 +112,9 @@ private void testInit() { public void testFinish() throws Exception { cleanUpOrganizations(createdOrgs); + if (organizationLevel == OrganizationLevel.SUB_ORGANIZATION) { + deleteApplication(applicationId); + } oAuth2RestClient.closeHttpClient(); super.testFinish(); } @@ -130,7 +137,6 @@ public void createOrganization() throws Exception { } else { org = "Level2Org"; parentId = subOrganizationId; - String applicationId = addApplication(); shareApplication(applicationId); if (!isLegacyRuntimeEnabled) { @@ -153,8 +159,6 @@ public void createOrganization() throws Exception { .when() .log().ifValidationFails() .post(ORGANIZATION_MANAGEMENT_API_BASE_PATH); - - deleteApp(applicationId); } responseOfPost.then() @@ -337,7 +341,7 @@ private String getRoleV2ResourceId(String audienceType) throws Exception { return null; } - private void deleteApp(String applicationId) throws Exception { + private void deleteApplication(String applicationId) throws Exception { oAuth2RestClient.deleteApplication(applicationId); }