Skip to content

Commit

Permalink
Add a test case
Browse files Browse the repository at this point in the history
  • Loading branch information
paf31 committed Dec 4, 2019
1 parent 98ba294 commit 2c71c7d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
description: GraphQL query to test batching in the style of Apollo
url: /v1/graphql
status: 200
response:
- data:
user:
- id: '1'
- id: '2'
- data:
author:
- id: 1
- id: 2
query:
- query: |
query {
user {
id
}
}
- query: |
query {
author {
id
}
}
4 changes: 4 additions & 0 deletions server/tests-py/test_graphql_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ def test_select_query_invalid_escape_sequence(self, hge_ctx, transport):
transport = 'http'
check_query_f(hge_ctx, self.dir() + "/select_query_invalid_escape_sequence.yaml", transport)

def test_select_query_batching(self, hge_ctx, transport):
transport = 'http'
check_query_f(hge_ctx, self.dir() + "/select_query_batching.yaml", transport)

@classmethod
def dir(cls):
return 'queries/graphql_query/basic'
Expand Down
3 changes: 2 additions & 1 deletion server/tests-py/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ def go(result_node, selset):
# Copy-pasta from: https://stackoverflow.com/q/12734517/176841
def stringify_keys(d):
"""Convert a dict's keys to strings if they are not."""
for key in d.keys():
if isinstance(d, dict):
for key in d.keys():
# check inner dict
if isinstance(d[key], dict):
value = stringify_keys(d[key])
Expand Down

0 comments on commit 2c71c7d

Please sign in to comment.