use of io.restassured.response.ValidatableResponse in project testcases by coheigea.
the class KnoxRangerTest method makeWebHDFSInvocation.
private void makeWebHDFSInvocation(int statusCode, String user, String password) throws IOException {
String basedir = System.getProperty("basedir");
if (basedir == null) {
basedir = new File(".").getCanonicalPath();
}
Path path = FileSystems.getDefault().getPath(basedir, "/src/test/resources/webhdfs-liststatus-test.json");
driver.getMock("WEBHDFS").expect().method("GET").pathInfo("/v1/hdfstest").queryParam("op", "LISTSTATUS").respond().status(HttpStatus.SC_OK).content(IOUtils.toByteArray(path.toUri())).contentType("application/json");
ValidatableResponse response = given().log().all().auth().preemptive().basic(user, password).header("X-XSRF-Header", "jksdhfkhdsf").queryParam("op", "LISTSTATUS").when().get(driver.getUrl("WEBHDFS") + "/v1/hdfstest").then().statusCode(statusCode).log().body();
if (statusCode == HttpStatus.SC_OK) {
response.body("FileStatuses.FileStatus[0].pathSuffix", is("dir"));
}
}
use of io.restassured.response.ValidatableResponse in project testcases by coheigea.
the class KnoxAuthorizationTest method makeWebHDFSInvocation.
private void makeWebHDFSInvocation(int statusCode, String user, String password) throws IOException {
String basedir = System.getProperty("basedir");
if (basedir == null) {
basedir = new File(".").getCanonicalPath();
}
Path path = FileSystems.getDefault().getPath(basedir, "/src/test/resources/webhdfs-liststatus-test.json");
driver.getMock("WEBHDFS").expect().method("GET").pathInfo("/v1/hdfstest").queryParam("op", "LISTSTATUS").respond().status(HttpStatus.SC_OK).content(IOUtils.toByteArray(path.toUri())).contentType("application/json");
ValidatableResponse response = given().log().all().auth().preemptive().basic(user, password).header("X-XSRF-Header", "jksdhfkhdsf").queryParam("op", "LISTSTATUS").when().get(driver.getUrl("WEBHDFS") + "/v1/hdfstest").then().statusCode(statusCode).log().body();
if (statusCode == HttpStatus.SC_OK) {
response.body("FileStatuses.FileStatus[0].pathSuffix", is("dir"));
}
}
use of io.restassured.response.ValidatableResponse in project wildfly-swarm by wildfly-swarm.
the class BaseTckTest method doCallEndpoint.
/**
* Calls the endpoint.
* @param format
*/
protected ValidatableResponse doCallEndpoint(String format) {
ValidatableResponse vr;
vr = given().accept(APPLICATION_JSON).when().get("/openapi").then().statusCode(200);
return vr;
}
Aggregations