use of integration.MongoDbSeed in project graylog2-server by Graylog2.
the class StreamsTest method updatingNonexistendStreamShouldFail.
@Test
@MongoDbSeed(locations = { "single-stream", "second-single-stream" })
public void updatingNonexistendStreamShouldFail() {
// id of nonexistent stream to be updated
final String streamId = "55affeaffeaffeaffeaffeaf";
// id of stream that is supposed to be left untampered
final String otherStreamId = "552b92b2e4b0c055e41ffb8e";
given().when().body("{\"title\":\"foo\", \"description\":\"bar\", \"index_set_id\":\"582f3c4e43761335e4859f72\"}").put("/streams/" + streamId).then().statusCode(404);
final JsonPath otherStreamResponse = given().when().get("/streams/" + otherStreamId).then().statusCode(200).extract().jsonPath();
assertThat(otherStreamResponse.getString("title")).isEqualTo("Just a stream");
assertThat(otherStreamResponse.getString("description")).isEqualTo("This is just a stream");
}
use of integration.MongoDbSeed in project graylog2-server by Graylog2.
the class StreamsTest method updatingTitleOfSingleStream.
@Test
@MongoDbSeed(locations = { "single-stream", "second-single-stream" })
public void updatingTitleOfSingleStream() {
// id of stream to be updated
final String streamId = "552b92b2e4b0c055e41ffb8d";
// id of stream that is supposed to be left untampered
final String otherStreamId = "552b92b2e4b0c055e41ffb8e";
assertThat(streamCount()).isEqualTo(2);
final JsonPath response = given().when().body(jsonResourceForMethod()).put("/streams/" + streamId).then().statusCode(200).contentType(ContentType.JSON).extract().jsonPath();
assertThat(response.getString("title")).isEqualTo("Updated Title");
assertThat(response.getString("description")).isEqualTo("This is yet another stream");
final JsonPath getResponse = given().when().get("/streams/" + streamId).then().statusCode(200).extract().jsonPath();
assertThat(getResponse.getString("title")).isEqualTo("Updated Title");
assertThat(getResponse.getString("description")).isEqualTo("This is yet another stream");
final JsonPath otherStreamResponse = given().when().get("/streams/" + otherStreamId).then().statusCode(200).extract().jsonPath();
assertThat(otherStreamResponse.getString("title")).isEqualTo("Just a stream");
assertThat(otherStreamResponse.getString("description")).isEqualTo("This is just a stream");
}
use of integration.MongoDbSeed in project graylog2-server by Graylog2.
the class StreamsTest method updatingUsingInvalidMatchingTypeOfStreamShouldFail.
@Test
@MongoDbSeed(locations = { "single-stream", "second-single-stream" })
public void updatingUsingInvalidMatchingTypeOfStreamShouldFail() {
final String streamId = "552b92b2e4b0c055e41ffb8d";
given().when().body("{\"matching_type\":\"INVALID\"}").put("/streams/" + streamId).then().statusCode(400);
final JsonPath getResponse = getStream(streamId).statusCode(200).extract().jsonPath();
assertThat(getResponse.getString("matching_type")).isEqualTo("AND");
}
use of integration.MongoDbSeed in project graylog2-server by Graylog2.
the class StreamsTest method updatingMatchingTypeOfStream.
@Test
@MongoDbSeed(locations = { "single-stream", "second-single-stream" })
public void updatingMatchingTypeOfStream() {
// id of stream to be updated
final String streamId = "552b92b2e4b0c055e41ffb8d";
// id of stream that is supposed to be left untampered
final String otherStreamId = "552b92b2e4b0c055e41ffb8e";
assertThat(streamCount()).isEqualTo(2);
final JsonPath response = given().when().body("{\"matching_type\":\"OR\"}").put("/streams/" + streamId).then().statusCode(200).contentType(ContentType.JSON).extract().jsonPath();
assertThat(response.getString("matching_type")).isEqualTo("OR");
getStream(streamId).statusCode(200).assertThat().body("matching_type", equalTo("OR"));
getStream(otherStreamId).statusCode(200).assertThat().body("matching_type", equalTo("AND"));
}
Aggregations