Search in sources :

Example 31 with Request

use of com.coveros.selenified.services.Request in project selenified by Coveros.

the class ServicesResponseIT method verifyJsonObjectDataCheckGetCall.

@Test(groups = { "integration", "service", "httpget", "response" }, description = "An integration test to verify json object response for data check")
public void verifyJsonObjectDataCheckGetCall() {
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    Map<String, Object> params = new HashMap<>();
    params.put("id", 4);
    assertTrue(call.get("posts/", new Request().setUrlParams(params)).isData());
    // verify no issues
    finish();
}
Also used : Call(com.coveros.selenified.services.Call) HashMap(java.util.HashMap) Request(com.coveros.selenified.services.Request) Test(org.testng.annotations.Test)

Example 32 with Request

use of com.coveros.selenified.services.Request in project selenified by Coveros.

the class ServicesOverrideIT method addHeaderDataTest.

@Test(groups = { "integration", "service", "headers" }, description = "An integration test to verify we can successfully set header values")
public void addHeaderDataTest() {
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // set some custom headers
    Map<String, Object> headers = new HashMap<>();
    headers.put("X-Atlassian-Token", "no-check");
    call.addHeaders(headers);
    // perform some actions - this will fail as application/xml isn't supported
    call.post("posts/", new Request().setJsonPayload(new JsonObject())).verifyEquals().code(201);
    // verify one issue
    finish(1);
}
Also used : Call(com.coveros.selenified.services.Call) HashMap(java.util.HashMap) Request(com.coveros.selenified.services.Request) JsonObject(com.google.gson.JsonObject) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 33 with Request

use of com.coveros.selenified.services.Request in project selenified by Coveros.

the class RequestTest method checkJsonDataRequestTest.

@Test
public void checkJsonDataRequestTest() {
    JsonObject json = new JsonObject();
    assertEquals(new Request().setJsonPayload(json).getJsonPayload(), json);
}
Also used : Request(com.coveros.selenified.services.Request) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 34 with Request

use of com.coveros.selenified.services.Request in project selenified by Coveros.

the class RequestTest method checkJsonObjectIsDataTest.

@Test
public void checkJsonObjectIsDataTest() {
    JsonObject json = new JsonObject();
    assertTrue(new Request().setJsonPayload(json).isPayload());
}
Also used : Request(com.coveros.selenified.services.Request) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 35 with Request

use of com.coveros.selenified.services.Request in project selenified by Coveros.

the class RequestTest method checkJsonDataDataRequestTest.

@Test
public void checkJsonDataDataRequestTest() {
    JsonObject json = new JsonObject();
    json.addProperty("name", "john");
    assertEquals(new Request().setJsonPayload(json).getJsonPayload(), json);
}
Also used : Request(com.coveros.selenified.services.Request) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Aggregations

Request (com.coveros.selenified.services.Request)198 Test (org.testng.annotations.Test)197 Call (com.coveros.selenified.services.Call)142 JsonObject (com.google.gson.JsonObject)115 HashMap (java.util.HashMap)102 File (java.io.File)32 JsonArray (com.google.gson.JsonArray)30 HTTP (com.coveros.selenified.services.HTTP)5 JsonParser (com.google.gson.JsonParser)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1