Skip to content

Commit

Permalink
+Coverage for quarkusio/quarkus#20293
Browse files Browse the repository at this point in the history
  • Loading branch information
fedinskiy committed Jan 5, 2022
1 parent f2253c4 commit afdd65a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions http/graphql/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
smallrye.graphql.allowGet=true
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static io.restassured.RestAssured.given;

import org.apache.http.HttpStatus;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

Expand All @@ -11,6 +12,7 @@

@QuarkusScenario
public class GraphQLIT {

@Test
public void recursive() {
final String query = createQuery("philosophers{name,friend{name,friend{name}}}");
Expand All @@ -21,6 +23,26 @@ public void recursive() {
Assertions.assertEquals("Plato", json.getString("data.philosophers[0].friend.friend.name"));
}

@Test
public void emptyGet() {
Response response = given().basePath("graphql")
.contentType("application/json")
.post();
Assertions.assertNotEquals(HttpStatus.SC_METHOD_NOT_ALLOWED, response.statusCode());
Assertions.assertNotEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, response.statusCode());
Assertions.assertNotEquals(HttpStatus.SC_NO_CONTENT, response.statusCode());
Assertions.assertEquals(HttpStatus.SC_BAD_REQUEST, response.statusCode());
}

@Test
public void emptyPost() {
Response response = given().basePath("graphql")
.contentType("application/json")
.post();
Assertions.assertNotEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, response.statusCode());
Assertions.assertEquals(HttpStatus.SC_BAD_REQUEST, response.statusCode());
}

public static Response sendQuery(String query) {
return given().basePath("graphql")
.contentType("application/json")
Expand Down

0 comments on commit afdd65a

Please sign in to comment.