Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Clean unused imports
Pacu2c754cff6579c
diff --git a/tests/api/test_account.py b/tests/api/test_account.pyindex fee8148ad7..08e4af79cf 100644--- a/tests/api/test_account.py+++ b/tests/api/test_account.py@@ -7,7 +7,6 @@ import pytestimport graphenefrom django.contrib.auth import get_user_modelfrom django.contrib.auth.tokens import default_token_generator-from django.shortcuts import reversefrom saleor.account.models import Address, Userfrom saleor.graphql.account.mutations import (SetPassword, StaffDelete, StaffUpdate)@@ -16,7 +15,7 @@ from tests.api.utils import get_graphql_contentfrom .utils import assert_no_permission, convert_dict_keys_to_camel_case-def test_create_token_mutation(admin_client, staff_user):+def test_create_token_mutation(admin_api_client, staff_user):query = """mutation {tokenCreate(email: "%(email)s", password: "%(password)s") {@@ -29,14 +28,14 @@ def test_create_token_mutation(admin_client, staff_user):}"""success_query = query % {'email': staff_user.email, 'password': 'password'}- response = admin_client.post_graphql(success_query)+ response = admin_api_client.post_graphql(success_query)content = get_graphql_content(response)token_data = content['data']['tokenCreate']assert token_data['token']assert not token_data['errors']error_query = query % {'email': staff_user.email, 'password': 'wat'}- response = admin_client.post_graphql(error_query)+ response = admin_api_client.post_graphql(error_query)content = get_graphql_content(response)token_data = content['data']['tokenCreate']assert not token_data['token']@@ -46,7 +45,7 @@ def test_create_token_mutation(admin_client, staff_user):def test_token_create_user_data(- permission_manage_orders, staff_client, staff_user):+ permission_manage_orders, staff_api_client, staff_user):query = """mutation {tokenCreate(email: "%(email)s", password: "%(password)s") {@@ -69,7 +68,7 @@ def test_token_create_user_data(user_id = graphene.Node.to_global_id('User', staff_user.id)query = query % {'email': staff_user.email, 'password': 'password'}- response = staff_client.post_graphql(query)+ response = staff_api_client.post_graphql(query)content = get_graphql_content(response)token_data = content['data']['tokenCreate']assert token_data['user']['id'] == user_iddiff --git a/tests/api/test_attributes.py b/tests/api/test_attributes.pyindex 628c225586..08232dbc63 100644--- a/tests/api/test_attributes.py+++ b/tests/api/test_attributes.py@@ -1,9 +1,6 @@-import json-import pytestimport graphene-from django.shortcuts import reversefrom django.template.defaultfilters import slugifyfrom saleor.graphql.product.types import (AttributeValueType, resolve_attribute_value_type)@@ -471,7 +468,7 @@ def test_query_attribute_values(}}"""- variables = json.dumps({'id': attribute_id})+ variables = {'id': attribute_id}response = user_api_client.post_graphql(query, variables)content = get_graphql_content(response)data = content['data']['attributes']['edges'][0]['node']diff --git a/tests/api/test_category.py b/tests/api/test_category.pyindex 59ac3bc2cf..8bc833b732 100644--- a/tests/api/test_category.py+++ b/tests/api/test_category.py@@ -1,12 +1,11 @@import json-import grapheneimport pytest-from django.shortcuts import reverse-from django.template.defaultfilters import slugify-from tests.api.utils import get_graphql_content+import graphene+from django.template.defaultfilters import slugifyfrom saleor.product.models import Category+from tests.api.utils import get_graphql_contentdef test_category_query(user_api_client, product):diff --git a/tests/api/test_core.py b/tests/api/test_core.pyindex 5534481d0c..139eb82dee 100644--- a/tests/api/test_core.py+++ b/tests/api/test_core.py@@ -2,12 +2,10 @@ import jsonfrom unittest.mock import Mockimport graphene-from django.shortcuts import reverse-from tests.api.utils import get_graphql_content-from saleor.graphql.core.utils import clean_seo_fields, snake_to_camel_casefrom saleor.graphql.product import types as product_typesfrom saleor.graphql.utils import get_database_id+from tests.api.utils import get_graphql_contentdef test_clean_seo_fields():diff --git a/tests/api/test_discount.py b/tests/api/test_discount.pyindex f386e707d6..3ebf967091 100644--- a/tests/api/test_discount.py+++ b/tests/api/test_discount.py@@ -1,14 +1,12 @@import json-import grapheneimport pytest-from django.shortcuts import reverse-from tests.api.utils import get_graphql_content-from saleor.discount import (- DiscountValueType, VoucherType)+import graphene+from saleor.discount import DiscountValueType, VoucherTypefrom saleor.graphql.discount.types import (DiscountValueTypeEnum, VoucherTypeEnum)+from tests.api.utils import get_graphql_contentfrom .utils import assert_no_permissiondiff --git a/tests/api/test_fulfillment.py b/tests/api/test_fulfillment.pyindex 697eea54f4..f50997338a 100644--- a/tests/api/test_fulfillment.py+++ b/tests/api/test_fulfillment.py@@ -1,12 +1,11 @@import json-import grapheneimport pytest-from django.shortcuts import reverse-from tests.api.utils import get_graphql_content+import graphenefrom saleor.order import OrderEvents, OrderEventsEmailsfrom saleor.order.models import FulfillmentStatus+from tests.api.utils import get_graphql_contentCREATE_FULFILLMENT_QUERY = """mutation fulfillOrder(diff --git a/tests/api/test_graphql.py b/tests/api/test_graphql.pyindex 78ed5675fa..0ed06804c2 100644--- a/tests/api/test_graphql.py+++ b/tests/api/test_graphql.py@@ -1,8 +1,9 @@import jsonfrom unittest.mock import Mock, patch-import grapheneimport pytest++import graphenefrom django.contrib.auth.models import AnonymousUserfrom django.db.models import Qfrom django.http import HttpResponse@@ -10,12 +11,11 @@ from django.shortcuts import reversefrom django.test import RequestFactoryfrom graphql_jwt.shortcuts import get_tokenfrom graphql_relay import to_global_id-from tests.api.utils import get_graphql_content-from saleor.graphql.middleware import jwt_middlewarefrom saleor.graphql.product.types import Productfrom saleor.graphql.utils import (filter_by_query_param, generate_query_argument_description, get_nodes)+from tests.api.utils import get_graphql_contentdef test_jwt_middleware(admin_user):diff --git a/tests/api/test_menu.py b/tests/api/test_menu.pyindex 834afdca45..b2750d063e 100644--- a/tests/api/test_menu.py+++ b/tests/api/test_menu.py@@ -3,7 +3,6 @@ import jsonimport pytestimport graphene-from django.shortcuts import reversefrom saleor.graphql.menu.mutations import NavigationTypefrom tests.api.utils import get_graphql_contentdiff --git a/tests/api/test_order.py b/tests/api/test_order.pyindex defbbe1022..ce95d66309 100644--- a/tests/api/test_order.py+++ b/tests/api/test_order.py@@ -4,7 +4,6 @@ from unittest.mock import MagicMock, Mockimport pytestimport graphene-from django.shortcuts import reversefrom payments import PaymentStatusfrom saleor.account.models import Addressfrom saleor.core.utils.taxes import ZERO_TAXED_MONEYdiff --git a/tests/api/test_page.py b/tests/api/test_page.pyindex b214ecd00e..c36b42925a 100644--- a/tests/api/test_page.py+++ b/tests/api/test_page.py@@ -3,7 +3,6 @@ import jsonimport pytestimport graphene-from django.shortcuts import reversefrom saleor.page.models import Pagefrom tests.api.utils import get_graphql_contentdiff --git a/tests/api/test_product.py b/tests/api/test_product.pyindex 5786d653c9..f9a108907a 100644--- a/tests/api/test_product.py+++ b/tests/api/test_product.py@@ -4,7 +4,6 @@ from unittest.mock import MagicMock, Mockimport pytestimport graphene-from django.shortcuts import reversefrom django.utils.text import slugifyfrom graphql_relay import to_global_idfrom prices import Moneydiff --git a/tests/api/test_shipping_method.py b/tests/api/test_shipping_method.pyindex 781b9154cf..b7f998e5fb 100644--- a/tests/api/test_shipping_method.py+++ b/tests/api/test_shipping_method.py@@ -3,7 +3,6 @@ import jsonimport pytestimport graphene-from django.shortcuts import reversefrom saleor.graphql.shipping.types import ShippingMethodTypeEnumfrom tests.api.utils import get_graphql_contentdiff --git a/tests/api/test_shop.py b/tests/api/test_shop.pyindex 4c13085d96..2fbc790904 100644--- a/tests/api/test_shop.py+++ b/tests/api/test_shop.py@@ -2,7 +2,6 @@ import jsonimport graphenefrom django.conf import settings-from django.shortcuts import reversefrom django_countries import countriesfrom saleor.core.permissions import MODELS_PERMISSIONSfrom saleor.site.models import Sitediff --git a/tests/api/test_variant.py b/tests/api/test_variant.pyindex 2e4c807878..e81900ce72 100644--- a/tests/api/test_variant.py+++ b/tests/api/test_variant.py@@ -1,8 +1,8 @@import json-import grapheneimport pytest-from django.shortcuts import reverse++import graphenefrom tests.api.utils import get_graphql_contentdiff --git a/tests/api/utils.py b/tests/api/utils.pyindex 3ebcfd68c9..9ea6e1b69d 100644--- a/tests/api/utils.py+++ b/tests/api/utils.py@@ -31,7 +31,7 @@ def get_multipart_request_body(query, variables, file, file_name):of additional 'operations' and 'map' keys."""return {- 'operations': json.dumps(query, variables),+ 'operations': json.dumps({'query': query, 'variables': variables}),'map': json.dumps({file_name: ['variables.file']}), file_name: file}