Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Added post_graphql helper function

Pacu26b7305ffb71a
diff --git a/tests/conftest.py b/tests/conftest.py
index 296ef4eda5..973dee992e 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -67,6 +67,17 @@ class ApiClient(Client):
kwargs['content_type'] = 'application/json'
return super().post(API_PATH, data, **kwargs)
+ def post_graphql(self, query=None, variables=None, **kwargs):
+ data = {}
+ if query is not None:
+ data['query'] = query
+ if variables is not None:
+ data['variables'] = variables
+ if data:
+ data = json.dumps(data)
+ kwargs['content_type'] = 'application/json'
+ return super().post(API_PATH, data, **kwargs)
+
def post_multipart(self, *args, **kwargs):
"""Send a multipart POST request.