Skip to content

Commit

Permalink
Added integration tests to validate key generation after app name is …
Browse files Browse the repository at this point in the history
…updated.
  • Loading branch information
prasa7 committed Jun 3, 2022
1 parent 7952be2 commit 611a38b
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -187,6 +189,14 @@ public void testUpdateApplication() throws Exception {
String newappDescription = "Application updated";
String newAppTier = "20PerMin";

ArrayList<String> 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(),
Expand All @@ -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,
Expand Down

0 comments on commit 611a38b

Please sign in to comment.