Skip to content

Commit

Permalink
Add a test case for search functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Shenali-SJ committed Dec 3, 2024
1 parent 525880f commit 80c7626
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@
import org.wso2.carbon.automation.engine.context.TestUserMode;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import javax.xml.xpath.XPathExpressionException;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.hamcrest.core.IsNull.nullValue;
Expand All @@ -46,6 +49,7 @@ public class IdPSuccessTest extends IdPTestBase {

private String idPId;
private String idPTemplateId;
private static final String IDP_NAME = "Google";

@Factory(dataProvider = "restAPIUserConfigProvider")
public IdPSuccessTest(TestUserMode userMode) throws Exception {
Expand Down Expand Up @@ -310,6 +314,20 @@ public void testGetIdPs() throws Exception {
context.getContextTenant().getDomain())));
}

@Test(dependsOnMethods = "testGetIdP")
public void testSearchAllIdPs() throws XPathExpressionException {

Response response = getResponseOfGetWithQueryParams(IDP_API_BASE_PATH, Collections.singletonMap("filter",
"name sw " + IDP_NAME));
response.then()
.log().ifValidationFails()
.assertThat()
.statusCode(HttpStatus.SC_OK)
.body("identityProviders.find { it.id == '" + idPId + "' }.name", equalTo(IDP_NAME))
.body("identityProviders.find { it.id == '" + idPId + "' }.isEnabled", equalTo(true))
.body("identityProviders.find { it.id == '" + idPId + "' }.self", equalTo(true));
}

@Test(dependsOnMethods = {"testGetIdPs"})
public void testGetIdPsWithRequiredAttribute() throws Exception {

Expand Down

0 comments on commit 80c7626

Please sign in to comment.