use of io.restassured.response.Response in project qpp-conversion-tool by CMSgov.
the class ValidationApiAcceptance method testUnprocessedFiles.
@AcceptanceTest
void testUnprocessedFiles() {
Response response = given().multiPart("file", PATH.toFile()).when().post("/");
AllErrors blah = response.getBody().as(AllErrors.class);
blah.getErrors().stream().flatMap(error -> error.getDetails().stream()).forEach(this::verifyDetail);
}
use of io.restassured.response.Response in project qpp-conversion-tool by CMSgov.
the class ValidationApiFailureAcceptance method testBadPerformanceStart.
@ParameterizedAcceptanceTest
@MethodSource("getFailureScenarios")
void testBadPerformanceStart(String comparison, Map<String, String> override) {
String qrda = getQrda(override);
Response response = performRequest(qrda);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY.value());
AllErrors blah = response.getBody().as(AllErrors.class);
blah.getErrors().stream().flatMap(error -> error.getDetails().stream()).forEach(verifyDetail(comparison, qrda));
}
use of io.restassured.response.Response in project fess by codelibs.
the class CrawlTestBase method startJob.
protected static void startJob(final String namePrefix) {
for (int i = 0; i < 30; i++) {
final Map<String, Object> requestBody = new HashMap<>();
final String schedulerId = getSchedulerIds(namePrefix).get(0);
final Response response = checkMethodBase(requestBody).post("/api/admin/scheduler/" + schedulerId + "/start");
if (response.getBody().jsonPath().getInt("response.status") == 0) {
logger.info("Start scheduler \"{}\"", schedulerId);
return;
}
ThreadUtil.sleep(1000L);
}
fail("could not start job.");
}
use of io.restassured.response.Response in project fess by codelibs.
the class SearchApiTests method createLabel.
private static String createLabel() {
Map<String, Object> labelBody = new HashMap<>();
labelBody.put("name", TEST_LABEL);
labelBody.put("value", TEST_LABEL);
labelBody.put("included_paths", ".*tools.*");
Response response = checkMethodBase(labelBody).put("/api/admin/labeltype/setting");
JsonPath jsonPath = JsonPath.from(response.asString());
assertTrue(jsonPath.getBoolean("response.created"));
assertEquals(0, jsonPath.getInt("response.status"));
return jsonPath.get("response.id");
}
use of io.restassured.response.Response in project dhis2-core by dhis2.
the class RestApiActions method get.
/**
* Sends get request with provided path and queryParams appended to URL.
*
* @param resourceId Id of resource
* @param queryParamsBuilder Query params to append to url
*/
public ApiResponse get(String resourceId, QueryParamsBuilder queryParamsBuilder) {
String path = queryParamsBuilder == null ? "" : queryParamsBuilder.build();
Response response = this.given().contentType(ContentType.TEXT).when().get(resourceId + path);
return new ApiResponse(response);
}
Aggregations