Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Decode JSON response before deserializing it
Marcin Gębala763c2e12ded3
diff --git a/tests/test_graphql.py b/tests/test_graphql.pyindex 09a7afb68e..f9d9eeae2f 100644--- a/tests/test_graphql.py+++ b/tests/test_graphql.py@@ -4,6 +4,10 @@ import pytestfrom saleor.product.models import Category+def get_content(response):+ return json.loads(response.content.decode('utf8'))++def assert_success_response(content):assert 'errors' not in contentassert 'data' in content@@ -35,7 +39,7 @@ def test_category_query(client, product_in_stock):}""" % {'category_pk': category.pk}response = client.post('/graphql/', {'query': query})- content = json.loads(response.content)+ content = get_content(response)assert_success_response(content)category_data = content['data']['viewer']['category']assert category_data is not None@@ -86,7 +90,7 @@ def test_product_query(client, product_in_stock):}""" % {'category_pk': category.pk}response = client.post('/graphql/', {'query': query})- content = json.loads(response.content)+ content = get_content(response)assert_success_response(content)assert content['data']['viewer']['category'] is not Noneproduct_edges_data = content['data']['viewer']['category']['products']['edges']