Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add test case for str errors with GraphQL debug enabled
NyanKiyoshifbabe213b120
diff --git a/saleor/graphql/menu/types.py b/saleor/graphql/menu/types.pyindex 20509aa6e0..9eff8e3393 100644--- a/saleor/graphql/menu/types.py+++ b/saleor/graphql/menu/types.py@@ -57,7 +57,8 @@ class MenuItem(CountableDjangoObjectType):sort_order = graphene.Field(graphene.Int,deprecation_reason=(- "Use the position in list instead and relative "+ "Will be dropped in 2.10 and is deprecated since 2.9: "+ "use the position in list instead and relative ""calculus to determine shift position."),)diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex 08b1632bc9..e3ce6cbbf1 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -1840,7 +1840,7 @@ input MenuInput {type MenuItem implements Node {id: ID!- sortOrder: Int @deprecated(reason: "Use the position in list instead and relative calculus to determine shift position.")+ sortOrder: Int @deprecated(reason: "Will be dropped in 2.10 and is deprecated since 2.9: use the position in list instead and relative calculus to determine shift position.")menu: Menu!name: String!parent: MenuItemdiff --git a/saleor/graphql/views.py b/saleor/graphql/views.pyindex 875ba55a4a..7f8c14dcbb 100644--- a/saleor/graphql/views.py+++ b/saleor/graphql/views.py@@ -203,7 +203,6 @@ class GraphQLView(View):if settings.DEBUG:lines = []- # FIXME: test :80if isinstance(exc, BaseException):for line in traceback.format_exception(type(exc), exc, exc.__traceback__diff --git a/tests/api/test_view.py b/tests/api/test_view.pyindex 46aabba6cf..d77d08f6f7 100644--- a/tests/api/test_view.py+++ b/tests/api/test_view.py@@ -70,7 +70,7 @@ def test_graphql_view_not_allowed(method, client):assert response.status_code == 405-def test_invalid_request_body(client):+def test_invalid_request_body_non_debug(client):data = "invalid-data"response = client.post(API_PATH, data, content_type="application/json")assert response.status_code == 400@@ -78,6 +78,21 @@ def test_invalid_request_body(client):assert "errors" in content+@override_settings(DEBUG=True)+def test_invalid_request_body_with_debug(client):+ data = "invalid-data"+ response = client.post(API_PATH, data, content_type="application/json")+ assert response.status_code == 400+ content = _get_graphql_content_from_response(response)+ errors = content.get("errors")+ assert errors == [+ {+ "extensions": {"exception": {"code": "str", "stacktrace ": []}},+ "message": "Unable to parse query.",+ }+ ]++def test_invalid_query(api_client):query = "query { invalid }"response = api_client.post_graphql(query, check_no_permissions=False)