Skip to content

Commit

Permalink
Improve integration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thisara-Welmilla committed Jan 24, 2025
1 parent 87022e1 commit a9a9072
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,23 @@ protected Response getResponseOfGet(String endpointUri) {
.get(endpointUri);
}

/**
* Invoke given endpointUri for GET with Basic authentication, authentication credential being the
* authenticatingUserName and authenticatingCredential with no filter.
*
* @param endpointUri endpoint to be invoked
* @return response
*/
protected Response getResponseOfGetNoFilter(String endpointUri) {

return given().auth().preemptive().basic(authenticatingUserName, authenticatingCredential)
.contentType(ContentType.JSON)
.header(HttpHeaders.ACCEPT, ContentType.JSON)
.log().ifValidationFails()
.when()
.get(endpointUri);
}

/**
* Invoke given endpointUri for GET with Basic authentication, authentication credential being the
* authenticatingUserName and authenticatingCredential
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,20 +213,17 @@ public void testValidateCustomTagInGetMetaTags() {
@Test(dependsOnMethods = {"testCreateUserDefinedLocalAuthenticator"})
public void testGetUserDefinedLocalAuthenticator() {

Response response = getResponseOfGet(AUTHENTICATOR_CONFIG_API_BASE_PATH + customIdPId);
Response response = getResponseOfGetNoFilter(AUTHENTICATOR_CONFIG_API_BASE_PATH + customIdPId);
response.then()
.log().ifValidationFails()
.assertThat()
.statusCode(HttpStatus.SC_OK)
.header(HttpHeaders.LOCATION, notNullValue())
.body("id", equalTo(customIdPId))
.body("name", equalTo(AUTHENTICATOR_NAME))
.body("displayName", equalTo(AUTHENTICATOR_DISPLAY_NAME))
.body("type", equalTo("LOCAL"))
.body("definedBy", equalTo("USER"))
.body("isEnabled", equalTo(true))
.body("endpoint.uri", equalTo(AUTHENTICATOR_ENDPOINT_URI))
.body("endpoint.authentication", equalTo("Basic"));
.body("isEnabled", equalTo(true));
}

@Test(dependsOnMethods = {"testGetUserDefinedLocalAuthenticator"})
Expand Down

0 comments on commit a9a9072

Please sign in to comment.