diff --git a/server/tests-py/queries/graphql_query/basic/select_query_batching.yaml b/server/tests-py/queries/graphql_query/basic/select_query_batching.yaml new file mode 100644 index 0000000000000..63526d7037252 --- /dev/null +++ b/server/tests-py/queries/graphql_query/basic/select_query_batching.yaml @@ -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 + } + } diff --git a/server/tests-py/test_graphql_queries.py b/server/tests-py/test_graphql_queries.py index 5714142a33855..483b86af918de 100644 --- a/server/tests-py/test_graphql_queries.py +++ b/server/tests-py/test_graphql_queries.py @@ -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' diff --git a/server/tests-py/validate.py b/server/tests-py/validate.py index 0e61dcbea5ff2..66b2366bd6aa9 100644 --- a/server/tests-py/validate.py +++ b/server/tests-py/validate.py @@ -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])