use of com.jayway.restassured.response.ValidatableResponse in project graylog2-server by Graylog2.
the class AbsoluteSearchResourceTest method searchForAllMessages.
@Test
@UsingDataSet(locations = "searchForExistingKeyword.json")
public void searchForAllMessages() {
final ValidatableResponse result = doSearchFor("*");
final JsonPath response = result.statusCode(200).extract().jsonPath();
assertThat(response.getInt("total_results")).isEqualTo(2);
assertThat(response.getList("messages")).hasSize(2);
assertThat(response.getList("used_indices")).hasSize(1);
}
use of com.jayway.restassured.response.ValidatableResponse in project graylog2-server by Graylog2.
the class AbsoluteSearchResourceTest method searchForExistingKeywordOutsideOfTimeRange.
@Test
@UsingDataSet(locations = "searchForExistingKeyword.json")
public void searchForExistingKeywordOutsideOfTimeRange() {
final ValidatableResponse result = doSearchFor("Testmessage", "2015-06-14T11:32:16.827Z", "2015-06-15T11:32:16.827Z");
final JsonPath response = result.statusCode(200).extract().jsonPath();
assertThat(response.getInt("total_results")).isEqualTo(0);
assertThat(response.getList("messages")).isEmpty();
assertThat(response.getList("used_indices")).hasSize(1);
}
use of com.jayway.restassured.response.ValidatableResponse in project graylog2-server by Graylog2.
the class AbsoluteSearchResourceTest method doSearchFor.
protected ValidatableResponse doSearchFor(String query, String from, String to) {
final ValidatableResponse result = given().when().param("query", query).param("from", from).param("to", to).get("/search/universal/absolute").then().body(".", containsAllKeys("query", "built_query", "used_indices", "messages", "fields", "time", "total_results", "from", "to"));
final JsonPath resultBody = result.extract().jsonPath();
assertThat(resultBody.getString("query")).isEqualTo(query);
return result;
}
use of com.jayway.restassured.response.ValidatableResponse in project graylog2-server by Graylog2.
the class StreamsTest method creatingStreamWithoutIndexSetIdShouldFail.
@Test
public void creatingStreamWithoutIndexSetIdShouldFail() throws Exception {
final int beforeCount = streamCount();
final ValidatableResponse response = createStreamFromRequest(jsonResourceForMethod());
response.statusCode(400);
assertThat(streamCount()).isEqualTo(beforeCount);
}
use of com.jayway.restassured.response.ValidatableResponse in project graylog2-server by Graylog2.
the class StreamsTest method creatingInvalidStreamShouldFail.
@Test
public void creatingInvalidStreamShouldFail() throws Exception {
final int beforeCount = streamCount();
final ValidatableResponse response = createStreamFromRequest("{}");
response.statusCode(400);
final int afterCount = streamCount();
assertThat(afterCount).isEqualTo(beforeCount);
}
Aggregations