diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/application/groupSharing/ApplicationSharingTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/application/groupSharing/ApplicationSharingTestCase.java index 12196876c3..cf3c85c829 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/application/groupSharing/ApplicationSharingTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/application/groupSharing/ApplicationSharingTestCase.java @@ -30,6 +30,8 @@ import org.wso2.am.integration.clients.store.api.ApiException; import org.wso2.am.integration.clients.store.api.v1.dto.ApplicationDTO; import org.wso2.am.integration.clients.store.api.v1.dto.ApplicationInfoDTO; +import org.wso2.am.integration.clients.store.api.v1.dto.ApplicationKeyGenerateRequestDTO; +import org.wso2.am.integration.clients.store.api.v1.dto.APIKeyDTO; import org.wso2.am.integration.test.impl.RestAPIStoreImpl; import org.wso2.am.integration.test.utils.UserManagementUtils; import org.wso2.am.integration.test.utils.base.APIMIntegrationBaseTest; @@ -79,8 +81,8 @@ public static Object[][] userModeDataProvider() { public void setEnvironment() throws Exception { super.init(userMode); - createUsersAndApplications(); groups.add(ORGANIZATION); + createUsersAndApplications(); } @Test(groups = "wso2.am", description = "Remove user one's application and check if user two's application also " + @@ -125,6 +127,23 @@ public void testEditApplicationByUserInApplicationGroup() throws ApiException { Assert.assertEquals(serviceResponse.getResponseCode(), HttpStatus.SC_FORBIDDEN); } + @Test(groups = "wso2.am", description = "Generate API key from user 1 and make sure that user 2 can revoke the key") + public void testAPIKeyRevocationBySharedUser() + throws ApiException { + + //Check for application availability + List user1AllAppsList = restAPIStoreClientUser1.getAllApps().getList(); + ApplicationDTO applicationDTO = restAPIStoreClientUser1.getApplicationById(userOneSharedApplicationId); + Assert.assertNotNull(applicationDTO); + Assert.assertEquals(applicationDTO.getName(), SHARED_APPLICATION_NAME); + + //Generate api key by user 1 + APIKeyDTO key = restAPIStoreClientUser1.generateAPIKeys(userOneSharedApplicationId, + ApplicationKeyGenerateRequestDTO.KeyTypeEnum.PRODUCTION.toString(), -1, null, null); + //Revoke api key by user 2 + restAPIStoreClientUser2.revokeAPIKey(userOneSharedApplicationId, key.getApikey()); + } + @AfterClass(alwaysRun = true) public void destroy() throws Exception { restAPIStoreClientUser2.removeApplicationById(userTwoApplicationId); diff --git a/pom.xml b/pom.xml index cc6deaeecc..8a739d703c 100644 --- a/pom.xml +++ b/pom.xml @@ -1280,7 +1280,7 @@ 9.0.476 - 9.28.190 + 9.28.195 [9.0.0, 10.0.0)