Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add aditional check in test
Michał Sipac3e92cd12690
diff --git a/saleor/graphql/menu/resolvers.py b/saleor/graphql/menu/resolvers.pyindex 951fb39b1f..53d6dd1be7 100644--- a/saleor/graphql/menu/resolvers.py+++ b/saleor/graphql/menu/resolvers.py@@ -3,8 +3,8 @@ from graphql.error import GraphQLErrorfrom ...menu import modelsfrom ..utils.filters import filter_by_query_param-from .types import Menufrom ..core.validators import validate_query_args+from .types import MenuMENU_SEARCH_FIELDS = ("name",)MENU_ITEM_SEARCH_FIELDS = ("name",)diff --git a/saleor/graphql/product/schema.py b/saleor/graphql/product/schema.pyindex e26d15b2a1..6c7b414382 100644--- a/saleor/graphql/product/schema.py+++ b/saleor/graphql/product/schema.py@@ -1,10 +1,10 @@import graphenefrom graphql.error import GraphQLError-from ..core.validators import validate_query_argsfrom ...core.permissions import ProductPermissionsfrom ..core.enums import ReportingPeriodfrom ..core.fields import FilterInputConnectionField, PrefetchingConnectionField+from ..core.validators import validate_query_argsfrom ..decorators import permission_requiredfrom ..translations.mutations import (AttributeTranslate,@@ -107,8 +107,8 @@ from .mutations.products import ()from .resolvers import (resolve_attributes,- resolve_category_by_slug,resolve_categories,+ resolve_category_by_slug,resolve_collection_by_slug,resolve_collections,resolve_digital_contents,diff --git a/tests/api/conftest.py b/tests/api/conftest.pyindex 8f78bc1d08..41de78a898 100644--- a/tests/api/conftest.py+++ b/tests/api/conftest.py@@ -1,6 +1,6 @@import json-import logging+import grapheneimport pytestfrom django.contrib.auth.models import AnonymousUser@@ -11,12 +11,11 @@ from graphql_jwt.shortcuts import get_tokenfrom saleor.account.models import Userfrom saleor.app.models import App+from saleor.graphql.views import handled_errors_logger, unhandled_errors_loggerfrom ..utils import flush_post_commit_hooksfrom .utils import assert_no_permission-from saleor.graphql.views import handled_errors_logger, unhandled_errors_logger-API_PATH = reverse("api")diff --git a/tests/api/test_category.py b/tests/api/test_category.pyindex c0c67f8fab..bd230e7b48 100644--- a/tests/api/test_category.py+++ b/tests/api/test_category.py@@ -3,16 +3,15 @@ from unittest.mock import Mock, patchimport grapheneimport pytest-from django.template.defaultfilters import slugifyfrom graphql_relay import to_global_idfrom saleor.product.error_codes import ProductErrorCodefrom saleor.product.models import Categoryfrom tests.api.utils import (+ construct_query_input,get_graphql_content,get_multipart_request_body,- construct_query_input,)from tests.utils import create_image, create_pdf_file_with_image_ext@@ -54,6 +53,8 @@ def test_category_query(assert graphql_log_handler.messages == ["saleor.graphql.errors.handled[ERROR].GraphQLError"]+ content = get_graphql_content(response, ignore_errors=True)+ assert len(content["errors"]) == 1else:response = user_api_client.post_graphql(query)content = get_graphql_content(response)diff --git a/tests/api/test_collection.py b/tests/api/test_collection.pyindex c2ac4bfb84..65230d0371 100644--- a/tests/api/test_collection.py+++ b/tests/api/test_collection.py@@ -11,9 +11,9 @@ from saleor.product.models import Collectionfrom tests.utils import create_image, create_pdf_file_with_image_extfrom .utils import (+ construct_query_input,get_graphql_content,get_multipart_request_body,- construct_query_input,)@@ -39,6 +39,8 @@ def test_collection_query(assert graphql_log_handler.messages == ["saleor.graphql.errors.handled[ERROR].GraphQLError"]+ content = get_graphql_content(response, ignore_errors=True)+ assert len(content["errors"]) == 1else:response = user_api_client.post_graphql(query)content = get_graphql_content(response)diff --git a/tests/api/test_menu.py b/tests/api/test_menu.pyindex 3191c439bd..a6af126768 100644--- a/tests/api/test_menu.py+++ b/tests/api/test_menu.py@@ -9,7 +9,7 @@ from saleor.menu.models import Menu, MenuItemfrom saleor.product.models import Categoryfrom tests.api.utils import get_graphql_content-from .utils import assert_no_permission, menu_item_to_json, construct_query_input+from .utils import assert_no_permission, construct_query_input, menu_item_to_jsondef test_validate_menu_item_instance(category, page):@@ -44,6 +44,8 @@ def test_collection_query(assert graphql_log_handler.messages == ["saleor.graphql.errors.handled[ERROR].GraphQLError"]+ content = get_graphql_content(response, ignore_errors=True)+ assert len(content["errors"]) == 1else:response = user_api_client.post_graphql(query)content = get_graphql_content(response)diff --git a/tests/api/test_product.py b/tests/api/test_product.pyindex b4a6d08096..3e4175c9ad 100644--- a/tests/api/test_product.py+++ b/tests/api/test_product.py@@ -36,8 +36,8 @@ from tests.utils import create_image, create_pdf_file_with_image_extfrom .utils import (assert_no_permission,- get_multipart_request_body,construct_query_input,+ get_multipart_request_body,)@@ -130,6 +130,8 @@ def test_collection_query(assert graphql_log_handler.messages == ["saleor.graphql.errors.handled[ERROR].GraphQLError"]+ content = get_graphql_content(response, ignore_errors=True)+ assert len(content["errors"]) == 1else:response = user_api_client.post_graphql(query)content = get_graphql_content(response)diff --git a/tests/api/utils.py b/tests/api/utils.pyindex 2ad809c265..40fe14547d 100644--- a/tests/api/utils.py+++ b/tests/api/utils.py@@ -1,7 +1,7 @@import jsonfrom typing import List-import graphene+import graphenefrom django.core.serializers.json import DjangoJSONEncoderfrom saleor.graphql.core.utils import snake_to_camel_case