From 1bad91ae7c12e904dbdedeefb96fe82549d73699 Mon Sep 17 00:00:00 2001 From: KaveeshaPiumini Date: Wed, 28 Aug 2024 10:34:21 +0530 Subject: [PATCH] Integration test for trusted app configs getting cleared issue --- .../management/v1/ApplicationPatchTest.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/ApplicationPatchTest.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/ApplicationPatchTest.java index fa7384ed486..e082e63b338 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/ApplicationPatchTest.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/ApplicationPatchTest.java @@ -162,6 +162,35 @@ public void testUpdateAdvancedConfiguration() throws Exception { equalTo("sample.app.id")); } + @Test(description = "Test updating values in the application's general section " + + "does not clear values in trusted app configurations", + dependsOnMethods = "testUpdateAdvancedConfiguration") + public void testUpdateApplicationWithTrustedAppConfigs() throws Exception { + + // Update the application with new values for app name + JSONObject updateRequest = new JSONObject(); + updateRequest.put("name", UPDATED_APP_NAME); + + String path = APPLICATION_MANAGEMENT_API_BASE_PATH + "/" + appId; + getResponseOfPatch(path, updateRequest.toString()).then() + .assertThat() + .statusCode(HttpStatus.SC_OK); + + // Verify that the trusted app configurations are still available. + getApplication(appId).then() + .body("name", equalTo(UPDATED_APP_NAME)) + .body("advancedConfigurations.trustedAppConfiguration.find{ it.key == 'isFIDOTrustedApp' }.value", + equalTo(true)) + .body("advancedConfigurations.trustedAppConfiguration.find{ it.key == 'isConsentGranted' }.value", + equalTo(true)) + .body("advancedConfigurations.trustedAppConfiguration.find{ it.key == 'androidPackageName' }.value", + equalTo("sample.package.name")) + .body("advancedConfigurations.trustedAppConfiguration.find{ it.key == 'androidThumbprints' }.value", + Matchers.hasItem("sampleThumbprint")) + .body("advancedConfigurations.trustedAppConfiguration.find{ it.key == 'appleAppId' }.value", + equalTo("sample.app.id")); + } + @Test(description = "Test updating the claim configuration of an application", dependsOnMethods = "testUpdateAdvancedConfiguration") public void testUpdateClaimConfiguration() throws Exception {