Skip to content

Commit

Permalink
Merge pull request #22865 from janakamarasena/master
Browse files Browse the repository at this point in the history
Temporarily disable the adaptive auth metadata test
  • Loading branch information
janakamarasena authored Feb 7, 2025
2 parents e18b4a4 + 3d04c10 commit 931f179
Showing 1 changed file with 29 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,33 +206,35 @@ public void testGetSAMLMetadata() throws IOException {
// }
// }

@Test
public void testGetAdaptiveAuthTemplates() throws IOException, JSONException {

Response response = getResponseOfGet(METADATA_API_BASE_PATH + PATH_SEPARATOR + ADAPTIVE_AUTH_PATH);
response.then()
.log()
.ifValidationFails()
.assertThat()
.statusCode(HttpStatus.SC_OK);

JSONObject expected = new JSONObject(new JSONObject(readResource("adaptive-metadata.json")).get(
JSON_KEY_TEMPLATES_JSON).toString());
JSONObject received = new JSONObject(new JSONObject(response.asString()).get(
JSON_KEY_TEMPLATES_JSON).toString());
Iterator<String> iterator = expected.keys();

while (iterator.hasNext()) {
String result = iterator.next();
if (!"uncategorized".equals(result)) {
JSONArray expectedTemplates = expected.getJSONObject(result).getJSONArray(JSON_KEY_TEMPLATES);
JSONArray receivedTemplates = received.getJSONObject(result).getJSONArray(JSON_KEY_TEMPLATES);

Assert.assertTrue(equalSets(expectedTemplates, receivedTemplates),
"Adaptive auth templates returned from the API doesn't match.");
}
}
}
/* Temporarily disabling the test due to a upcoming change to the templates which will break the tests.
the test will be updated and re-enabled once the component is released. */
// @Test
// public void testGetAdaptiveAuthTemplates() throws IOException, JSONException {
//
// Response response = getResponseOfGet(METADATA_API_BASE_PATH + PATH_SEPARATOR + ADAPTIVE_AUTH_PATH);
// response.then()
// .log()
// .ifValidationFails()
// .assertThat()
// .statusCode(HttpStatus.SC_OK);
//
// JSONObject expected = new JSONObject(new JSONObject(readResource("adaptive-metadata.json")).get(
// JSON_KEY_TEMPLATES_JSON).toString());
// JSONObject received = new JSONObject(new JSONObject(response.asString()).get(
// JSON_KEY_TEMPLATES_JSON).toString());
// Iterator<String> iterator = expected.keys();
//
// while (iterator.hasNext()) {
// String result = iterator.next();
// if (!"uncategorized".equals(result)) {
// JSONArray expectedTemplates = expected.getJSONObject(result).getJSONArray(JSON_KEY_TEMPLATES);
// JSONArray receivedTemplates = received.getJSONObject(result).getJSONArray(JSON_KEY_TEMPLATES);
//
// Assert.assertTrue(equalSets(expectedTemplates, receivedTemplates),
// "Adaptive auth templates returned from the API doesn't match.");
// }
// }
// }

private boolean equalSets(JSONArray ja1, JSONArray ja2) throws JSONException {

Expand Down

0 comments on commit 931f179

Please sign in to comment.