Search in sources :

Example 81 with Request

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

the class ServicesIT method verifySuccessfulPutCallMultipartDataWithFile.

@Test(groups = { "integration", "service", "httpput", "response" }, description = "An integration test to verify a successful put call with parameters")
public void verifySuccessfulPutCallMultipartDataWithFile() {
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.put("post/4", new Request().setMultipartData(new HashMap<>()), new File("Jenkinsfile")).verifyEquals().message("");
    // verify no issues
    finish();
}
Also used : Call(com.coveros.selenified.services.Call) HashMap(java.util.HashMap) Request(com.coveros.selenified.services.Request) File(java.io.File) Test(org.testng.annotations.Test)

Example 82 with Request

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

the class ServicesIT method overrideContentTypeTest.

@Test(groups = { "integration", "service", "headers" }, description = "An integration negative test to verify we can successfully change header values")
public void overrideContentTypeTest() {
    JsonObject request = new JsonObject();
    request.addProperty("title", "foo");
    request.addProperty("body", "bar");
    request.addProperty("userId", 2);
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    call.setContentType(HTTP.ContentType.FORMDATA);
    // perform some actions
    call.post("posts/", new Request().setJsonPayload(request)).verifyEquals().code(404);
    // verify no issues
    finish();
}
Also used : Call(com.coveros.selenified.services.Call) Request(com.coveros.selenified.services.Request) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 83 with Request

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

the class ServicesIT method verifySuccessfulPutCallNoDataWithFile.

@Test(groups = { "integration", "service", "httpput", "response" }, description = "An integration test to verify a successful put call with parameters")
public void verifySuccessfulPutCallNoDataWithFile() {
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.put("post/4", new Request(), new File("Jenkinsfile")).verifyEquals().message("");
    // verify no issues
    finish();
}
Also used : Call(com.coveros.selenified.services.Call) Request(com.coveros.selenified.services.Request) File(java.io.File) Test(org.testng.annotations.Test)

Example 84 with Request

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

the class ServicesIT method verifySuccessfulPostParamsCallNoData.

@Test(groups = { "integration", "service", "httppost", "response" }, description = "An integration test to verify a successful post call with parameters")
public void verifySuccessfulPostParamsCallNoData() {
    Map<String, Object> params = new HashMap<>();
    params.put("id", 4);
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.post("post/4", new Request().setUrlParams(params)).verifyEquals().objectData(simJson4);
    // verify no issues
    finish();
}
Also used : Call(com.coveros.selenified.services.Call) HashMap(java.util.HashMap) Request(com.coveros.selenified.services.Request) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 85 with Request

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

the class ServicesIT method verifySuccessfulPatchCallMultipartData.

@Test(groups = { "integration", "service", "httppatch", "response" }, description = "An integration test to verify a successful patch call with parameters")
public void verifySuccessfulPatchCallMultipartData() {
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    Map<String, Object> map = new HashMap<>();
    map.put("hello", "world");
    call.patch("post/4", new Request().setMultipartData(map)).verifyEquals().message("");
    // verify no issues
    finish();
}
Also used : Call(com.coveros.selenified.services.Call) HashMap(java.util.HashMap) 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