From 611a38b3f11cc01f23298a915acb14d2a9d304a1 Mon Sep 17 00:00:00 2001 From: Prasanna Dangalla Date: Fri, 3 Jun 2022 23:05:07 +0530 Subject: [PATCH] Added integration tests to validate key generation after app name is updated. --- .../APIM678ApplicationCreationTestCase.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/other/APIM678ApplicationCreationTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/other/APIM678ApplicationCreationTestCase.java index 726f7c834b..338aa3863a 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/other/APIM678ApplicationCreationTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/other/APIM678ApplicationCreationTestCase.java @@ -31,6 +31,8 @@ import org.testng.annotations.Test; 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.ApplicationKeyDTO; +import org.wso2.am.integration.clients.store.api.v1.dto.ApplicationKeyGenerateRequestDTO; import org.wso2.am.integration.clients.store.api.v1.dto.ApplicationListDTO; import org.wso2.am.integration.test.impl.RestAPIStoreImpl; import org.wso2.am.integration.test.utils.base.APIMIntegrationBaseTest; @@ -187,6 +189,14 @@ public void testUpdateApplication() throws Exception { String newappDescription = "Application updated"; String newAppTier = "20PerMin"; + ArrayList grantTypes = new ArrayList<>(); + grantTypes.add(APIMIntegrationConstants.GRANT_TYPE.CLIENT_CREDENTIAL); + + ApplicationKeyDTO applicationKeyDTO = restAPIStore + .generateKeys(applicationId, "3600", null, ApplicationKeyGenerateRequestDTO.KeyTypeEnum.PRODUCTION, + null, grantTypes); + + assertNotNull(applicationKeyDTO.getToken().getAccessToken()); //Update AppTier HttpResponse updateTierResponse = restAPIStore.updateApplicationByID(applicationResponse.getData(), @@ -202,6 +212,12 @@ public void testUpdateApplication() throws Exception { assertTrue(updateNameResponse.getData().contains(newAppName), "Error while updating application name" + applicationName); + ApplicationKeyDTO applicationKeyDTONew = restAPIStore + .generateKeys(applicationId, "3600", null, ApplicationKeyGenerateRequestDTO.KeyTypeEnum.PRODUCTION, + null, grantTypes); + + assertNotNull(applicationKeyDTONew.getToken().getAccessToken()); + //Update AppDescription HttpResponse updateDesResponse = restAPIStore.updateApplicationByID(applicationResponse.getData(), applicationName, newappDescription, newAppTier,