Skip to content

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

Move and split api test utils

fowczrekf12f64f901da
diff --git a/saleor/graphql/account/tests/benchmark/test_account.py b/saleor/graphql/account/tests/benchmark/test_account.py
index 204efbf4fa..7601dd1579 100644
--- a/saleor/graphql/account/tests/benchmark/test_account.py
+++ b/saleor/graphql/account/tests/benchmark/test_account.py
@@ -6,7 +6,7 @@ from django.contrib.auth.models import Group
from django.core.files import File
from saleor.account.models import User
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
@pytest.mark.django_db
diff --git a/saleor/graphql/account/tests/benchmark/test_permission_group.py b/saleor/graphql/account/tests/benchmark/test_permission_group.py
index b0fc72a05a..62bf7e063f 100644
--- a/saleor/graphql/account/tests/benchmark/test_permission_group.py
+++ b/saleor/graphql/account/tests/benchmark/test_permission_group.py
@@ -3,7 +3,7 @@ import pytest
from django.contrib.auth.models import Group
from saleor.core.permissions import AccountPermissions
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
@pytest.mark.django_db
diff --git a/saleor/graphql/account/tests/test_account.py b/saleor/graphql/account/tests/test_account.py
index 4c803eb759..7a852fb11b 100644
--- a/saleor/graphql/account/tests/test_account.py
+++ b/saleor/graphql/account/tests/test_account.py
@@ -29,15 +29,15 @@ from saleor.graphql.account.mutations.staff import (
StaffUpdate,
UserDelete,
)
+from saleor.graphql.account.tests.utils import convert_dict_keys_to_camel_case
from saleor.graphql.core.utils import str_to_enum
-from saleor.order.models import FulfillmentStatus, Order
-from saleor.product.tests.utils import create_image
-from tests.api.utils import (
+from saleor.graphql.tests.utils import (
assert_no_permission,
- convert_dict_keys_to_camel_case,
get_graphql_content,
get_multipart_request_body,
)
+from saleor.order.models import FulfillmentStatus, Order
+from saleor.product.tests.utils import create_image
@pytest.fixture
diff --git a/saleor/graphql/account/tests/test_account_depreceated_service_account.py b/saleor/graphql/account/tests/test_account_depreceated_service_account.py
index 640416c203..e750a4e5a1 100644
--- a/saleor/graphql/account/tests/test_account_depreceated_service_account.py
+++ b/saleor/graphql/account/tests/test_account_depreceated_service_account.py
@@ -6,7 +6,7 @@ from freezegun import freeze_time
from saleor.account.error_codes import AccountErrorCode
from saleor.app.models import App, AppToken
from saleor.graphql.core.enums import PermissionEnum
-from tests.api.utils import assert_no_permission, get_graphql_content
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
@pytest.fixture
diff --git a/saleor/graphql/account/tests/test_account_events.py b/saleor/graphql/account/tests/test_account_events.py
index 9d5a68ca47..9fc031890d 100644
--- a/saleor/graphql/account/tests/test_account_events.py
+++ b/saleor/graphql/account/tests/test_account_events.py
@@ -3,7 +3,7 @@ from django.db import models
from saleor.account import events as account_events
from saleor.account.models import User
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
QUERY_CUSTOMER_EVENTS = """
query customerEvents($customerId: ID!) {
diff --git a/saleor/graphql/account/tests/test_account_meta.py b/saleor/graphql/account/tests/test_account_meta.py
index 86c360e7b2..1a528c16c3 100644
--- a/saleor/graphql/account/tests/test_account_meta.py
+++ b/saleor/graphql/account/tests/test_account_meta.py
@@ -4,7 +4,7 @@ import json
import graphene
import pytest
-from tests.api.utils import assert_no_permission, get_graphql_content
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
PRIVATE_META_NAMESPACE = ""
PUBLIC_META_NAMESPACE = ""
diff --git a/saleor/graphql/account/tests/test_account_permission_group.py b/saleor/graphql/account/tests/test_account_permission_group.py
index 734506057a..6dc6b2b4ba 100644
--- a/saleor/graphql/account/tests/test_account_permission_group.py
+++ b/saleor/graphql/account/tests/test_account_permission_group.py
@@ -5,7 +5,7 @@ from django.contrib.auth.models import Group
from saleor.account.error_codes import PermissionGroupErrorCode
from saleor.account.models import User
from saleor.core.permissions import AccountPermissions, AppPermission, OrderPermissions
-from tests.api.utils import assert_no_permission, get_graphql_content
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
PERMISSION_GROUP_CREATE_MUTATION = """
mutation PermissionGroupCreate(
diff --git a/saleor/graphql/account/tests/test_bulk_delete.py b/saleor/graphql/account/tests/test_bulk_delete.py
index 7c78a07af5..7406d181e3 100644
--- a/saleor/graphql/account/tests/test_bulk_delete.py
+++ b/saleor/graphql/account/tests/test_bulk_delete.py
@@ -6,7 +6,7 @@ from django.contrib.auth.models import Group
from saleor.account.error_codes import AccountErrorCode
from saleor.account.models import User
from saleor.core.permissions import AccountPermissions, OrderPermissions
-from tests.api.utils import assert_no_permission, get_graphql_content
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
@patch(
diff --git a/saleor/graphql/account/tests/test_pagination.py b/saleor/graphql/account/tests/test_pagination.py
index 29a0ccfc4a..3a958f006d 100644
--- a/saleor/graphql/account/tests/test_pagination.py
+++ b/saleor/graphql/account/tests/test_pagination.py
@@ -2,8 +2,8 @@ import pytest
from django.contrib.auth import models as auth_models
from saleor.account.models import User
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.order.models import Order
-from tests.api.utils import get_graphql_content
@pytest.fixture()
diff --git a/saleor/graphql/account/tests/test_pagination_deprecated_service_account.py b/saleor/graphql/account/tests/test_pagination_deprecated_service_account.py
index 651278946b..e9c2365bc7 100644
--- a/saleor/graphql/account/tests/test_pagination_deprecated_service_account.py
+++ b/saleor/graphql/account/tests/test_pagination_deprecated_service_account.py
@@ -1,7 +1,7 @@
import pytest
from saleor.app.models import App
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
@pytest.fixture()
diff --git a/saleor/graphql/account/tests/utils.py b/saleor/graphql/account/tests/utils.py
new file mode 100644
index 0000000000..83c418d448
--- /dev/null
+++ b/saleor/graphql/account/tests/utils.py
@@ -0,0 +1,14 @@
+from saleor.graphql.core.utils import snake_to_camel_case
+
+
+def convert_dict_keys_to_camel_case(d):
+ """Changes dict fields from d[field_name] to d[fieldName].
+
+ Useful when dealing with dict data such as address that need to be parsed
+ into graphql input.
+ """
+ data = {}
+ for k, v in d.items():
+ new_key = snake_to_camel_case(k)
+ data[new_key] = d[k]
+ return data
diff --git a/saleor/graphql/app/tests/test_app_mutations.py b/saleor/graphql/app/tests/test_app_mutations.py
index e9ecb20e87..a4489ebaac 100644
--- a/saleor/graphql/app/tests/test_app_mutations.py
+++ b/saleor/graphql/app/tests/test_app_mutations.py
@@ -3,7 +3,7 @@ import graphene
from saleor.app.error_codes import AppErrorCode
from saleor.app.models import App, AppToken
from saleor.graphql.core.enums import PermissionEnum
-from tests.api.utils import assert_no_permission, get_graphql_content
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
APP_CREATE_MUTATION = """
mutation AppCreate(
diff --git a/saleor/graphql/app/tests/test_app_queries.py b/saleor/graphql/app/tests/test_app_queries.py
index 10a07f6835..5a0579d4c2 100644
--- a/saleor/graphql/app/tests/test_app_queries.py
+++ b/saleor/graphql/app/tests/test_app_queries.py
@@ -3,8 +3,8 @@ import pytest
from freezegun import freeze_time
from saleor.app.models import App
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
from saleor.webhook.models import Webhook
-from tests.api.utils import assert_no_permission, get_graphql_content
QUERY_APPS_WITH_FILTER = """
query ($filter: AppFilterInput ){
diff --git a/saleor/graphql/app/tests/test_pagination.py b/saleor/graphql/app/tests/test_pagination.py
index d173c65b62..51c2901ed2 100644
--- a/saleor/graphql/app/tests/test_pagination.py
+++ b/saleor/graphql/app/tests/test_pagination.py
@@ -1,7 +1,7 @@
import pytest
from saleor.app.models import App
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
@pytest.fixture()
diff --git a/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.py b/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.py
index 02f441ee8b..a347c1b9ac 100644
--- a/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.py
+++ b/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.py
@@ -3,7 +3,7 @@ from graphene import Node
from saleor.checkout import calculations
from saleor.checkout.models import Checkout
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
FRAGMENT_PRICE = """
fragment Price on TaxedMoney {
diff --git a/saleor/graphql/checkout/tests/benchmark/test_homepage.py b/saleor/graphql/checkout/tests/benchmark/test_homepage.py
index aa97cf84f8..9cdb31ee2e 100644
--- a/saleor/graphql/checkout/tests/benchmark/test_homepage.py
+++ b/saleor/graphql/checkout/tests/benchmark/test_homepage.py
@@ -1,6 +1,6 @@
import pytest
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
@pytest.mark.django_db
diff --git a/saleor/graphql/checkout/tests/test_checkout.py b/saleor/graphql/checkout/tests/test_checkout.py
index 997d8e285d..eb0919a5fd 100644
--- a/saleor/graphql/checkout/tests/test_checkout.py
+++ b/saleor/graphql/checkout/tests/test_checkout.py
@@ -23,13 +23,13 @@ from saleor.graphql.checkout.utils import (
clean_checkout_payment,
clean_checkout_shipping,
)
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
from saleor.order.models import Order
from saleor.payment import TransactionKind
from saleor.payment.interface import GatewayResponse
from saleor.plugins.manager import PluginsManager
from saleor.warehouse.models import Stock
from saleor.warehouse.tests.utils import get_available_quantity_for_stock
-from tests.api.utils import assert_no_permission, get_graphql_content
@pytest.fixture(autouse=True)
diff --git a/saleor/graphql/checkout/tests/test_checkout_digital.py b/saleor/graphql/checkout/tests/test_checkout_digital.py
index e3a3bed60a..dda58fb145 100644
--- a/saleor/graphql/checkout/tests/test_checkout_digital.py
+++ b/saleor/graphql/checkout/tests/test_checkout_digital.py
@@ -8,8 +8,8 @@ from saleor.checkout.error_codes import CheckoutErrorCode
from saleor.checkout.models import Checkout
from saleor.checkout.utils import add_variant_to_checkout
from saleor.graphql.checkout.mutations import update_checkout_shipping_method_if_invalid
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.order.models import Order
-from tests.api.utils import get_graphql_content
from .test_checkout import (
MUTATION_CHECKOUT_COMPLETE,
diff --git a/saleor/graphql/checkout/tests/test_checkout_promo_codes.py b/saleor/graphql/checkout/tests/test_checkout_promo_codes.py
index b658486f02..38a9f7b8d3 100644
--- a/saleor/graphql/checkout/tests/test_checkout_promo_codes.py
+++ b/saleor/graphql/checkout/tests/test_checkout_promo_codes.py
@@ -7,7 +7,7 @@ from prices import Money
from saleor.checkout import calculations
from saleor.checkout.utils import add_voucher_to_checkout
from saleor.discount import DiscountInfo, VoucherType
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
from .test_checkout import (
MUTATION_CHECKOUT_LINES_DELETE,
diff --git a/saleor/graphql/core/tests/test_core.py b/saleor/graphql/core/tests/test_core.py
index 9abd4bbc53..982c71be0d 100644
--- a/saleor/graphql/core/tests/test_core.py
+++ b/saleor/graphql/core/tests/test_core.py
@@ -21,10 +21,13 @@ from saleor.graphql.core.utils import (
validate_slug_and_generate_if_needed,
)
from saleor.graphql.product import types as product_types
+from saleor.graphql.tests.utils import (
+ _get_graphql_content_from_response,
+ get_graphql_content,
+)
from saleor.graphql.utils import get_database_id, requestor_is_superuser
from saleor.graphql.utils.filters import filter_range_field, reporting_period_to_date
from saleor.product.models import Category, Product
-from tests.api.utils import _get_graphql_content_from_response, get_graphql_content
def test_clean_seo_fields():
diff --git a/saleor/graphql/core/tests/test_federation.py b/saleor/graphql/core/tests/test_federation.py
index 11795dcd66..4ae1a75bc4 100644
--- a/saleor/graphql/core/tests/test_federation.py
+++ b/saleor/graphql/core/tests/test_federation.py
@@ -1,7 +1,7 @@
import graphene
import pytest
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
@pytest.fixture
diff --git a/saleor/graphql/core/tests/test_graphql.py b/saleor/graphql/core/tests/test_graphql.py
index ea9e6a9c20..06c075b890 100644
--- a/saleor/graphql/core/tests/test_graphql.py
+++ b/saleor/graphql/core/tests/test_graphql.py
@@ -10,9 +10,9 @@ from graphql.error import GraphQLError
from graphql_relay import to_global_id
from saleor.graphql.product.types import Product
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.graphql.utils import get_nodes
from saleor.graphql.utils.filters import filter_by_query_param
-from tests.api.utils import get_graphql_content
def test_middleware_dont_generate_sql_requests(client, settings, assert_num_queries):
diff --git a/saleor/graphql/core/tests/test_scalars.py b/saleor/graphql/core/tests/test_scalars.py
index c1a1cdbcfa..b82ed2ea84 100644
--- a/saleor/graphql/core/tests/test_scalars.py
+++ b/saleor/graphql/core/tests/test_scalars.py
@@ -1,4 +1,4 @@
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
QUERY_CHECKOUT = """
query getCheckout($token: UUID!) {
diff --git a/saleor/graphql/core/tests/test_view.py b/saleor/graphql/core/tests/test_view.py
index 40f3e625a4..0a2551e605 100644
--- a/saleor/graphql/core/tests/test_view.py
+++ b/saleor/graphql/core/tests/test_view.py
@@ -7,7 +7,10 @@ from django.test import override_settings
from saleor.demo.views import EXAMPLE_QUERY
from saleor.graphql.product.types import Product
from saleor.graphql.tests.fixtures import API_PATH
-from tests.api.utils import _get_graphql_content_from_response, get_graphql_content
+from saleor.graphql.tests.utils import (
+ _get_graphql_content_from_response,
+ get_graphql_content,
+)
def test_batch_queries(category, product, api_client):
diff --git a/saleor/graphql/discount/tests/test_bulk_delete.py b/saleor/graphql/discount/tests/test_bulk_delete.py
index a1295d924e..7d9b3d856c 100644
--- a/saleor/graphql/discount/tests/test_bulk_delete.py
+++ b/saleor/graphql/discount/tests/test_bulk_delete.py
@@ -2,7 +2,7 @@ import graphene
import pytest
from saleor.discount.models import Sale, Voucher
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
@pytest.fixture
diff --git a/saleor/graphql/discount/tests/test_discount.py b/saleor/graphql/discount/tests/test_discount.py
index 4aa11ce656..a8106aa4fe 100644
--- a/saleor/graphql/discount/tests/test_discount.py
+++ b/saleor/graphql/discount/tests/test_discount.py
@@ -10,7 +10,7 @@ from saleor.discount import DiscountValueType, VoucherType
from saleor.discount.error_codes import DiscountErrorCode
from saleor.discount.models import Sale, Voucher
from saleor.graphql.discount.enums import DiscountValueTypeEnum, VoucherTypeEnum
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
@pytest.fixture
diff --git a/saleor/graphql/discount/tests/test_pagination.py b/saleor/graphql/discount/tests/test_pagination.py
index 5909c19029..87d29ecaab 100644
--- a/saleor/graphql/discount/tests/test_pagination.py
+++ b/saleor/graphql/discount/tests/test_pagination.py
@@ -6,7 +6,7 @@ from freezegun import freeze_time
from saleor.discount import DiscountValueType, VoucherType
from saleor.discount.models import Sale, Voucher
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
@pytest.fixture
diff --git a/saleor/graphql/giftcard/tests/test_gift_card.py b/saleor/graphql/giftcard/tests/test_gift_card.py
index 748e0308ed..08c5226ac4 100644
--- a/saleor/graphql/giftcard/tests/test_gift_card.py
+++ b/saleor/graphql/giftcard/tests/test_gift_card.py
@@ -3,7 +3,7 @@ from datetime import date
import graphene
from saleor.giftcard.error_codes import GiftCardErrorCode
-from tests.api.utils import assert_no_permission, get_graphql_content
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
def test_query_gift_card_with_permissions(
diff --git a/saleor/graphql/menu/tests/benchmark.py/test_homepage.py b/saleor/graphql/menu/tests/benchmark.py/test_homepage.py
index 936b0491fd..d0cd09eaf9 100644
--- a/saleor/graphql/menu/tests/benchmark.py/test_homepage.py
+++ b/saleor/graphql/menu/tests/benchmark.py/test_homepage.py
@@ -1,6 +1,6 @@
import pytest
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
@pytest.mark.django_db
diff --git a/saleor/graphql/menu/tests/test_bulk_delete.py b/saleor/graphql/menu/tests/test_bulk_delete.py
index 16d73668f3..a45ec4b4c9 100644
--- a/saleor/graphql/menu/tests/test_bulk_delete.py
+++ b/saleor/graphql/menu/tests/test_bulk_delete.py
@@ -1,8 +1,9 @@
import graphene
import pytest
+from saleor.graphql.menu.tests.utils import menu_item_to_json
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.menu.models import Menu, MenuItem
-from tests.api.utils import get_graphql_content, menu_item_to_json
@pytest.fixture
diff --git a/saleor/graphql/menu/tests/test_menu.py b/saleor/graphql/menu/tests/test_menu.py
index c162a212ee..023999841f 100644
--- a/saleor/graphql/menu/tests/test_menu.py
+++ b/saleor/graphql/menu/tests/test_menu.py
@@ -5,9 +5,10 @@ import pytest
from django.core.exceptions import ValidationError
from saleor.graphql.menu.mutations import NavigationType, _validate_menu_item_instance
+from saleor.graphql.menu.tests.utils import menu_item_to_json
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
from saleor.menu.models import Menu, MenuItem
from saleor.product.models import Category
-from tests.api.utils import assert_no_permission, get_graphql_content, menu_item_to_json
def test_validate_menu_item_instance(category, page):
diff --git a/saleor/graphql/menu/tests/test_pagination.py b/saleor/graphql/menu/tests/test_pagination.py
index 3ad2b746fd..ff5d47f1b1 100644
--- a/saleor/graphql/menu/tests/test_pagination.py
+++ b/saleor/graphql/menu/tests/test_pagination.py
@@ -1,7 +1,7 @@
import pytest
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.menu.models import Menu, MenuItem
-from tests.api.utils import get_graphql_content
@pytest.fixture
diff --git a/saleor/graphql/menu/tests/utils.py b/saleor/graphql/menu/tests/utils.py
new file mode 100644
index 0000000000..020327091d
--- /dev/null
+++ b/saleor/graphql/menu/tests/utils.py
@@ -0,0 +1,8 @@
+from saleor.menu.utils import get_menu_item_as_dict
+
+
+def menu_item_to_json(menu_item):
+ """Transforms a menu item to a JSON representation as used in the storefront."""
+ item_json = get_menu_item_as_dict(menu_item)
+ item_json["child_items"] = []
+ return item_json
diff --git a/saleor/graphql/meta/tests/test_meta_mutations.py b/saleor/graphql/meta/tests/test_meta_mutations.py
index 5c7eef7266..ebaefbaba4 100644
--- a/saleor/graphql/meta/tests/test_meta_mutations.py
+++ b/saleor/graphql/meta/tests/test_meta_mutations.py
@@ -5,7 +5,7 @@ import graphene
from saleor.core.error_codes import MetadataErrorCode
from saleor.core.models import ModelWithMetadata
-from tests.api.utils import assert_no_permission, get_graphql_content
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
PRIVATE_KEY = "private_key"
PRIVATE_VALUE = "private_vale"
diff --git a/saleor/graphql/meta/tests/test_meta_queries.py b/saleor/graphql/meta/tests/test_meta_queries.py
index 51daff5d44..2986cac4f4 100644
--- a/saleor/graphql/meta/tests/test_meta_queries.py
+++ b/saleor/graphql/meta/tests/test_meta_queries.py
@@ -1,6 +1,6 @@
import graphene
-from tests.api.utils import assert_no_permission, get_graphql_content
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
PRIVATE_KEY = "private_key"
PRIVATE_VALUE = "private_vale"
diff --git a/saleor/graphql/order/tests/benchmark/test_order.py b/saleor/graphql/order/tests/benchmark/test_order.py
index b19eb36b8f..f16f2aafcc 100644
--- a/saleor/graphql/order/tests/benchmark/test_order.py
+++ b/saleor/graphql/order/tests/benchmark/test_order.py
@@ -4,7 +4,7 @@ from saleor.graphql.checkout.tests.benchmark.test_checkout_mutations import (
FRAGMENT_ADDRESS,
FRAGMENT_PRODUCT_VARIANT,
)
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
FRAGMENT_ORDER_DETAILS = (
FRAGMENT_ADDRESS
diff --git a/saleor/graphql/order/tests/test_bulk_delete.py b/saleor/graphql/order/tests/test_bulk_delete.py
index 52e1f0ec83..f31bfdd758 100644
--- a/saleor/graphql/order/tests/test_bulk_delete.py
+++ b/saleor/graphql/order/tests/test_bulk_delete.py
@@ -1,7 +1,7 @@
import graphene
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.order import OrderStatus, models as order_models
-from tests.api.utils import get_graphql_content
MUTATION_DELETE_ORDER_LINES = """
mutation draftOrderLinesBulkDelete($ids: [ID]!) {
diff --git a/saleor/graphql/order/tests/test_fulfillment.py b/saleor/graphql/order/tests/test_fulfillment.py
index 1a0c884edb..c189c8ec5a 100644
--- a/saleor/graphql/order/tests/test_fulfillment.py
+++ b/saleor/graphql/order/tests/test_fulfillment.py
@@ -6,12 +6,12 @@ from django.contrib.auth.models import AnonymousUser
from saleor.core.exceptions import InsufficientStock
from saleor.core.permissions import OrderPermissions
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
from saleor.order import OrderStatus
from saleor.order.error_codes import OrderErrorCode
from saleor.order.events import OrderEvents
from saleor.order.models import FulfillmentStatus
from saleor.warehouse.models import Allocation, Stock
-from tests.api.utils import assert_no_permission, get_graphql_content
ORDER_FULFILL_QUERY = """
mutation fulfillOrder(
diff --git a/saleor/graphql/order/tests/test_homepage.py b/saleor/graphql/order/tests/test_homepage.py
index a6541f3460..dfeac701dd 100644
--- a/saleor/graphql/order/tests/test_homepage.py
+++ b/saleor/graphql/order/tests/test_homepage.py
@@ -1,4 +1,4 @@
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
def test_homepage_events(order_events, staff_api_client, permission_manage_orders):
diff --git a/saleor/graphql/order/tests/test_order.py b/saleor/graphql/order/tests/test_order.py
index 3588293afd..864e6780e8 100644
--- a/saleor/graphql/order/tests/test_order.py
+++ b/saleor/graphql/order/tests/test_order.py
@@ -21,6 +21,7 @@ from saleor.graphql.order.mutations.orders import (
)
from saleor.graphql.order.utils import validate_draft_order
from saleor.graphql.payment.types import PaymentChargeStatusEnum
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
from saleor.order import OrderStatus, events as order_events
from saleor.order.error_codes import OrderErrorCode
from saleor.order.models import Order, OrderEvent
@@ -30,7 +31,6 @@ from saleor.plugins.manager import PluginsManager
from saleor.shipping.models import ShippingMethod
from saleor.warehouse.models import Allocation, Stock
from saleor.warehouse.tests.utils import get_available_quantity_for_stock
-from tests.api.utils import assert_no_permission, get_graphql_content
@pytest.fixture
diff --git a/saleor/graphql/order/tests/test_pagination.py b/saleor/graphql/order/tests/test_pagination.py
index be45661831..1451d1dd47 100644
--- a/saleor/graphql/order/tests/test_pagination.py
+++ b/saleor/graphql/order/tests/test_pagination.py
@@ -6,9 +6,9 @@ import pytest
from freezegun import freeze_time
from prices import Money, TaxedMoney
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.order.models import Order, OrderStatus
from saleor.payment import ChargeStatus
-from tests.api.utils import get_graphql_content
@pytest.fixture()
diff --git a/saleor/graphql/page/tests/test_bulk_delete.py b/saleor/graphql/page/tests/test_bulk_delete.py
index 62afe90fd9..63c153d6c0 100644
--- a/saleor/graphql/page/tests/test_bulk_delete.py
+++ b/saleor/graphql/page/tests/test_bulk_delete.py
@@ -1,7 +1,7 @@
import graphene
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.page.models import Page
-from tests.api.utils import get_graphql_content
def test_delete_pages(staff_api_client, page_list, permission_manage_pages):
diff --git a/saleor/graphql/page/tests/test_page.py b/saleor/graphql/page/tests/test_page.py
index 87b72b7bd6..8d7117b070 100644
--- a/saleor/graphql/page/tests/test_page.py
+++ b/saleor/graphql/page/tests/test_page.py
@@ -6,9 +6,9 @@ from django.utils import timezone
from django.utils.text import slugify
from freezegun import freeze_time
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.page.error_codes import PageErrorCode
from saleor.page.models import Page
-from tests.api.utils import get_graphql_content
PAGE_QUERY = """
query PageQuery($id: ID, $slug: String) {
diff --git a/saleor/graphql/payment/tests/test_payment.py b/saleor/graphql/payment/tests/test_payment.py
index 7f4c3e0b30..aaaaa5c5c8 100644
--- a/saleor/graphql/payment/tests/test_payment.py
+++ b/saleor/graphql/payment/tests/test_payment.py
@@ -6,11 +6,11 @@ from django_countries.fields import Country
from saleor.checkout import calculations
from saleor.graphql.payment.enums import OrderAction, PaymentChargeStatusEnum
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
from saleor.payment.error_codes import PaymentErrorCode
from saleor.payment.interface import CreditCardInfo, CustomerSource, TokenConfig
from saleor.payment.models import ChargeStatus, Payment, TransactionKind
from saleor.payment.utils import fetch_customer_id, store_customer_id
-from tests.api.utils import assert_no_permission, get_graphql_content
VOID_QUERY = """
mutation PaymentVoid($paymentId: ID!) {
diff --git a/saleor/graphql/plugins/tests/test_plugins.py b/saleor/graphql/plugins/tests/test_plugins.py
index 5c0d2c571a..a3a5cd7c98 100644
--- a/saleor/graphql/plugins/tests/test_plugins.py
+++ b/saleor/graphql/plugins/tests/test_plugins.py
@@ -2,13 +2,13 @@ import copy
import pytest
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
from saleor.plugins.base_plugin import ConfigurationTypeField
from saleor.plugins.error_codes import PluginErrorCode
from saleor.plugins.manager import get_plugins_manager
from saleor.plugins.models import PluginConfiguration
from saleor.plugins.tests.sample_plugins import PluginSample
from saleor.plugins.tests.utils import get_config_value
-from tests.api.utils import assert_no_permission, get_graphql_content
@pytest.fixture
diff --git a/saleor/graphql/product/tests/benchmark/test_category.py b/saleor/graphql/product/tests/benchmark/test_category.py
index 5f4ea73195..d7e441fa69 100644
--- a/saleor/graphql/product/tests/benchmark/test_category.py
+++ b/saleor/graphql/product/tests/benchmark/test_category.py
@@ -1,7 +1,7 @@
import graphene
import pytest
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
@pytest.mark.django_db
diff --git a/saleor/graphql/product/tests/benchmark/test_collection.py b/saleor/graphql/product/tests/benchmark/test_collection.py
index 212a3fdab5..4fbe3e1b5a 100644
--- a/saleor/graphql/product/tests/benchmark/test_collection.py
+++ b/saleor/graphql/product/tests/benchmark/test_collection.py
@@ -1,7 +1,7 @@
import graphene
import pytest
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
@pytest.mark.django_db
diff --git a/saleor/graphql/product/tests/benchmark/test_homepage.py b/saleor/graphql/product/tests/benchmark/test_homepage.py
index 23fdf9c0bc..7302147c46 100644
--- a/saleor/graphql/product/tests/benchmark/test_homepage.py
+++ b/saleor/graphql/product/tests/benchmark/test_homepage.py
@@ -1,6 +1,6 @@
import pytest
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
@pytest.mark.django_db
diff --git a/saleor/graphql/product/tests/benchmark/test_product.py b/saleor/graphql/product/tests/benchmark/test_product.py
index 13bd2d6d98..80e265d9b2 100644
--- a/saleor/graphql/product/tests/benchmark/test_product.py
+++ b/saleor/graphql/product/tests/benchmark/test_product.py
@@ -1,7 +1,7 @@
import pytest
from graphene import Node
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
@pytest.mark.django_db
diff --git a/saleor/graphql/product/tests/benchmark/test_variant.py b/saleor/graphql/product/tests/benchmark/test_variant.py
index 63cb6a72d3..028926a927 100644
--- a/saleor/graphql/product/tests/benchmark/test_variant.py
+++ b/saleor/graphql/product/tests/benchmark/test_variant.py
@@ -3,9 +3,9 @@ from uuid import uuid4
import graphene
import pytest
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.product.models import ProductVariant
from saleor.warehouse.models import Stock
-from tests.api.utils import get_graphql_content
@pytest.mark.django_db
diff --git a/saleor/graphql/product/tests/benchmark/test_variant_stocks.py b/saleor/graphql/product/tests/benchmark/test_variant_stocks.py
index 78ea13524a..4ceb85cd67 100644
--- a/saleor/graphql/product/tests/benchmark/test_variant_stocks.py
+++ b/saleor/graphql/product/tests/benchmark/test_variant_stocks.py
@@ -1,8 +1,8 @@
import graphene
import pytest
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.warehouse.models import Stock, Warehouse
-from tests.api.utils import get_graphql_content
@pytest.mark.django_db
diff --git a/saleor/graphql/product/tests/test_attribute_pagination.py b/saleor/graphql/product/tests/test_attribute_pagination.py
index c8666ac8a6..4a86cc85ce 100644
--- a/saleor/graphql/product/tests/test_attribute_pagination.py
+++ b/saleor/graphql/product/tests/test_attribute_pagination.py
@@ -2,6 +2,7 @@ import graphene
import pytest
from prices import Money
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.product.models import (
Attribute,
AttributeProduct,
@@ -9,7 +10,6 @@ from saleor.product.models import (
Product,
ProductType,
)
-from tests.api.utils import get_graphql_content
@pytest.fixture
diff --git a/saleor/graphql/product/tests/test_attributes.py b/saleor/graphql/product/tests/test_attributes.py
index f9c7616798..fbaf8b6313 100644
--- a/saleor/graphql/product/tests/test_attributes.py
+++ b/saleor/graphql/product/tests/test_attributes.py
@@ -14,6 +14,7 @@ from saleor.graphql.product.enums import AttributeTypeEnum, AttributeValueType
from saleor.graphql.product.filters import filter_attributes_by_product_types
from saleor.graphql.product.mutations.attributes import validate_value_is_unique
from saleor.graphql.product.types.attributes import resolve_attribute_value_type
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.product import AttributeInputType
from saleor.product.error_codes import ProductErrorCode
from saleor.product.models import (
@@ -28,7 +29,6 @@ from saleor.product.models import (
ProductVariant,
)
from saleor.product.utils.attributes import associate_attribute_values_to_instance
-from tests.api.utils import get_graphql_content
def test_validate_value_is_unique(color_attribute):
diff --git a/saleor/graphql/product/tests/test_bulk_delete.py b/saleor/graphql/product/tests/test_bulk_delete.py
index 59750a8fcb..84ee9d0913 100644
--- a/saleor/graphql/product/tests/test_bulk_delete.py
+++ b/saleor/graphql/product/tests/test_bulk_delete.py
@@ -3,6 +3,7 @@ from unittest.mock import patch
import graphene
import pytest
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.product.models import (
Attribute,
AttributeValue,
@@ -13,7 +14,6 @@ from saleor.product.models import (
ProductType,
ProductVariant,
)
-from tests.api.utils import get_graphql_content
@pytest.fixture
diff --git a/saleor/graphql/product/tests/test_category.py b/saleor/graphql/product/tests/test_category.py
index a61133dc64..41fd66ccf5 100644
--- a/saleor/graphql/product/tests/test_category.py
+++ b/saleor/graphql/product/tests/test_category.py
@@ -6,10 +6,10 @@ import pytest
from django.template.defaultfilters import slugify
from graphql_relay import to_global_id
+from saleor.graphql.tests.utils import get_graphql_content, get_multipart_request_body
from saleor.product.error_codes import ProductErrorCode
from saleor.product.models import Category
from saleor.product.tests.utils import create_image, create_pdf_file_with_image_ext
-from tests.api.utils import get_graphql_content, get_multipart_request_body
QUERY_CATEGORY = """
query ($id: ID, $slug: String){
diff --git a/saleor/graphql/product/tests/test_collection.py b/saleor/graphql/product/tests/test_collection.py
index 8c5d236f38..f91a05d5c4 100644
--- a/saleor/graphql/product/tests/test_collection.py
+++ b/saleor/graphql/product/tests/test_collection.py
@@ -6,10 +6,10 @@ import graphene
import pytest
from graphql_relay import to_global_id
+from saleor.graphql.tests.utils import get_graphql_content, get_multipart_request_body
from saleor.product.error_codes import ProductErrorCode
from saleor.product.models import Collection
from saleor.product.tests.utils import create_image, create_pdf_file_with_image_ext
-from tests.api.utils import get_graphql_content, get_multipart_request_body
QUERY_COLLECTION = """
query ($id: ID, $slug: String){
diff --git a/saleor/graphql/product/tests/test_digital_content.py b/saleor/graphql/product/tests/test_digital_content.py
index 8aab20e0a9..96eca1911f 100644
--- a/saleor/graphql/product/tests/test_digital_content.py
+++ b/saleor/graphql/product/tests/test_digital_content.py
@@ -1,9 +1,9 @@
import graphene
+from saleor.graphql.tests.utils import get_graphql_content, get_multipart_request_body
from saleor.product.error_codes import ProductErrorCode
from saleor.product.models import DigitalContent, ProductVariant
from saleor.product.tests.utils import create_image
-from tests.api.utils import get_graphql_content, get_multipart_request_body
def test_fetch_all_digital_contents(
diff --git a/saleor/graphql/product/tests/test_product.py b/saleor/graphql/product/tests/test_product.py
index 55954eb2c6..7385cc9ed9 100644
--- a/saleor/graphql/product/tests/test_product.py
+++ b/saleor/graphql/product/tests/test_product.py
@@ -15,6 +15,11 @@ from saleor.core.taxes import TaxType
from saleor.graphql.core.enums import ReportingPeriod
from saleor.graphql.product.bulk_mutations.products import ProductVariantStocksUpdate
from saleor.graphql.product.utils import create_stocks
+from saleor.graphql.tests.utils import (
+ assert_no_permission,
+ get_graphql_content,
+ get_multipart_request_body,
+)
from saleor.plugins.manager import PluginsManager
from saleor.product import AttributeInputType
from saleor.product.error_codes import ProductErrorCode
@@ -32,11 +37,6 @@ from saleor.product.tasks import update_variants_names
from saleor.product.tests.utils import create_image, create_pdf_file_with_image_ext
from saleor.product.utils.attributes import associate_attribute_values_to_instance
from saleor.warehouse.models import Allocation, Stock, Warehouse
-from tests.api.utils import (
- assert_no_permission,
- get_graphql_content,
- get_multipart_request_body,
-)
@pytest.fixture
diff --git a/saleor/graphql/product/tests/test_product_minimal_variant_price.py b/saleor/graphql/product/tests/test_product_minimal_variant_price.py
index ee58a4acbb..ccb903d985 100644
--- a/saleor/graphql/product/tests/test_product_minimal_variant_price.py
+++ b/saleor/graphql/product/tests/test_product_minimal_variant_price.py
@@ -6,8 +6,8 @@ from graphql_relay import from_global_id, to_global_id
from prices import Money
from saleor.graphql.discount.enums import DiscountValueTypeEnum
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.product.error_codes import ProductErrorCode
-from tests.api.utils import get_graphql_content
def test_product_create_sets_minimal_variant_price(
diff --git a/saleor/graphql/product/tests/test_product_pagination.py b/saleor/graphql/product/tests/test_product_pagination.py
index 1ae592aced..580ab096af 100644
--- a/saleor/graphql/product/tests/test_product_pagination.py
+++ b/saleor/graphql/product/tests/test_product_pagination.py
@@ -4,6 +4,7 @@ import graphene
import pytest
from prices import Money
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.product.models import (
Category,
Collection,
@@ -13,7 +14,6 @@ from saleor.product.models import (
)
from saleor.product.utils.attributes import associate_attribute_values_to_instance
from saleor.warehouse.models import Stock
-from tests.api.utils import get_graphql_content
@pytest.fixture
diff --git a/saleor/graphql/product/tests/test_product_sorting.py b/saleor/graphql/product/tests/test_product_sorting.py
index 8b13b9f0d2..b4367500bf 100644
--- a/saleor/graphql/product/tests/test_product_sorting.py
+++ b/saleor/graphql/product/tests/test_product_sorting.py
@@ -1,6 +1,6 @@
import graphene
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
GET_SORTED_PRODUCTS_COLLECTION_QUERY = """
query CollectionProducts($id: ID!) {
diff --git a/saleor/graphql/product/tests/test_product_sorting_attributes.py b/saleor/graphql/product/tests/test_product_sorting_attributes.py
index 946c7f9d72..c2d7c0803a 100644
--- a/saleor/graphql/product/tests/test_product_sorting_attributes.py
+++ b/saleor/graphql/product/tests/test_product_sorting_attributes.py
@@ -4,9 +4,9 @@ import graphene
import pytest
from saleor.core.taxes import zero_money
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.product import models as product_models
from saleor.product.utils.attributes import associate_attribute_values_to_instance
-from tests.api.utils import get_graphql_content
HERE = os.path.realpath(os.path.dirname(__file__))
diff --git a/saleor/graphql/product/tests/test_variant.py b/saleor/graphql/product/tests/test_variant.py
index 62ffc6d1ac..d971044f2d 100644
--- a/saleor/graphql/product/tests/test_variant.py
+++ b/saleor/graphql/product/tests/test_variant.py
@@ -5,12 +5,12 @@ import graphene
import pytest
from graphene.utils.str_converters import to_camel_case
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.product.error_codes import ProductErrorCode
from saleor.product.models import ProductVariant
from saleor.product.utils.attributes import associate_attribute_values_to_instance
from saleor.warehouse.error_codes import StockErrorCode
from saleor.warehouse.models import Stock, Warehouse
-from tests.api.utils import get_graphql_content
def test_fetch_variant(staff_api_client, product, permission_manage_products):
diff --git a/saleor/graphql/product/tests/test_variant_pricing.py b/saleor/graphql/product/tests/test_variant_pricing.py
index 02209597cd..188d093b2b 100644
--- a/saleor/graphql/product/tests/test_variant_pricing.py
+++ b/saleor/graphql/product/tests/test_variant_pricing.py
@@ -2,10 +2,10 @@ from unittest.mock import Mock
from prices import Money, TaxedMoney
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.plugins.manager import PluginsManager
from saleor.product.models import ProductVariant
from saleor.product.utils.availability import get_variant_availability
-from tests.api.utils import get_graphql_content
QUERY_GET_VARIANT_PRICING = """
query {
diff --git a/saleor/graphql/shipping/tests/test_bulk_delete.py b/saleor/graphql/shipping/tests/test_bulk_delete.py
index ada17df549..dc9548ce3d 100644
--- a/saleor/graphql/shipping/tests/test_bulk_delete.py
+++ b/saleor/graphql/shipping/tests/test_bulk_delete.py
@@ -1,8 +1,8 @@
import graphene
import pytest
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.shipping.models import ShippingMethod, ShippingZone
-from tests.api.utils import get_graphql_content
@pytest.fixture
diff --git a/saleor/graphql/shipping/tests/test_shipping_method.py b/saleor/graphql/shipping/tests/test_shipping_method.py
index ee78fc87b8..6aef1a118d 100644
--- a/saleor/graphql/shipping/tests/test_shipping_method.py
+++ b/saleor/graphql/shipping/tests/test_shipping_method.py
@@ -2,8 +2,8 @@ import graphene
import pytest
from saleor.graphql.shipping.types import ShippingMethodTypeEnum
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.shipping.error_codes import ShippingErrorCode
-from tests.api.utils import get_graphql_content
def test_shipping_zone_query(
diff --git a/saleor/graphql/shop/tests/benchmark/test_homepage.py b/saleor/graphql/shop/tests/benchmark/test_homepage.py
index b21a5eeaee..0c76d3e55a 100644
--- a/saleor/graphql/shop/tests/benchmark/test_homepage.py
+++ b/saleor/graphql/shop/tests/benchmark/test_homepage.py
@@ -1,6 +1,6 @@
import pytest
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
@pytest.mark.django_db
diff --git a/saleor/graphql/shop/tests/test_shop.py b/saleor/graphql/shop/tests/test_shop.py
index 0ad08fea29..3e83478685 100644
--- a/saleor/graphql/shop/tests/test_shop.py
+++ b/saleor/graphql/shop/tests/test_shop.py
@@ -8,9 +8,9 @@ from saleor.account.models import Address
from saleor.core.error_codes import ShopErrorCode
from saleor.core.permissions import get_permissions_codename
from saleor.graphql.core.utils import str_to_enum
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.site import AuthenticationBackends
from saleor.site.models import Site
-from tests.api.utils import get_graphql_content
def test_query_authorization_keys(
diff --git a/saleor/graphql/shop/tests/test_shop_taxes.py b/saleor/graphql/shop/tests/test_shop_taxes.py
index 34e89f9d9e..2905e925eb 100644
--- a/saleor/graphql/shop/tests/test_shop_taxes.py
+++ b/saleor/graphql/shop/tests/test_shop_taxes.py
@@ -5,7 +5,7 @@ from django_prices_vatlayer.models import VAT
from django_prices_vatlayer.utils import get_tax_for_rate
from saleor.graphql.core.utils import str_to_enum
-from tests.api.utils import get_graphql_content
+from saleor.graphql.tests.utils import get_graphql_content
# FIXME we are going to rewrite tax section. Currently, below tests are connected only
# with vatlayer. After we introduce approach for taxes and API, we should rebuild this
diff --git a/saleor/graphql/tests/fixtures.py b/saleor/graphql/tests/fixtures.py
index 39409cf634..00811ca0a5 100644
--- a/saleor/graphql/tests/fixtures.py
+++ b/saleor/graphql/tests/fixtures.py
@@ -11,9 +11,9 @@ from graphql_jwt.shortcuts import get_token
from saleor.account.models import User
from saleor.app.models import App
+from saleor.graphql.tests.utils import assert_no_permission
from saleor.graphql.views import handled_errors_logger, unhandled_errors_logger
from saleor.tests.utils import flush_post_commit_hooks
-from tests.api.utils import assert_no_permission
API_PATH = reverse("api")
diff --git a/tests/api/utils.py b/saleor/graphql/tests/utils.py
similarity index 66%
rename from tests/api/utils.py
rename to saleor/graphql/tests/utils.py
index 129dbe32e8..7bc4aabaac 100644
--- a/tests/api/utils.py
+++ b/saleor/graphql/tests/utils.py
@@ -2,9 +2,6 @@ import json
from django.core.serializers.json import DjangoJSONEncoder
-from saleor.graphql.core.utils import snake_to_camel_case
-from saleor.menu.utils import get_menu_item_as_dict
-
def _get_graphql_content_from_response(response):
return json.loads(response.content.decode("utf8"))
@@ -42,23 +39,3 @@ def get_multipart_request_body(query, variables, file, file_name):
"map": json.dumps({file_name: ["variables.file"]}, cls=DjangoJSONEncoder),
file_name: file,
}
-
-
-def convert_dict_keys_to_camel_case(d):
- """Changes dict fields from d[field_name] to d[fieldName].
-
- Useful when dealing with dict data such as address that need to be parsed
- into graphql input.
- """
- data = {}
- for k, v in d.items():
- new_key = snake_to_camel_case(k)
- data[new_key] = d[k]
- return data
-
-
-def menu_item_to_json(menu_item):
- """Transforms a menu item to a JSON representation as used in the storefront."""
- item_json = get_menu_item_as_dict(menu_item)
- item_json["child_items"] = []
- return item_json
diff --git a/saleor/graphql/translations/tests/test_translations.py b/saleor/graphql/translations/tests/test_translations.py
index 07d5e90ffd..7dbed94fc4 100644
--- a/saleor/graphql/translations/tests/test_translations.py
+++ b/saleor/graphql/translations/tests/test_translations.py
@@ -2,9 +2,9 @@ import graphene
import pytest
from django.contrib.auth.models import Permission
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
from saleor.graphql.translations.schema import TranslatableKinds
from saleor.graphql.translations.types import LanguageCodeEnum
-from tests.api.utils import assert_no_permission, get_graphql_content
def test_product_translation(user_api_client, product):
diff --git a/saleor/graphql/warehouse/tests/test_pagination.py b/saleor/graphql/warehouse/tests/test_pagination.py
index 19ec9f1a74..b5fa2da09c 100644
--- a/saleor/graphql/warehouse/tests/test_pagination.py
+++ b/saleor/graphql/warehouse/tests/test_pagination.py
@@ -1,8 +1,8 @@
import graphene
import pytest
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.warehouse.models import Warehouse
-from tests.api.utils import get_graphql_content
@pytest.fixture
diff --git a/saleor/graphql/warehouse/tests/test_stock.py b/saleor/graphql/warehouse/tests/test_stock.py
index d2d693402f..986096fb75 100644
--- a/saleor/graphql/warehouse/tests/test_stock.py
+++ b/saleor/graphql/warehouse/tests/test_stock.py
@@ -1,9 +1,9 @@
import graphene
from saleor.core.permissions import ProductPermissions
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
from saleor.warehouse.models import Stock
from saleor.warehouse.tests.utils import get_quantity_allocated_for_stock
-from tests.api.utils import assert_no_permission, get_graphql_content
QUERY_STOCK = """
query stock($id: ID!) {
diff --git a/saleor/graphql/warehouse/tests/test_warehouse.py b/saleor/graphql/warehouse/tests/test_warehouse.py
index df933eb3f8..9be586f3ff 100644
--- a/saleor/graphql/warehouse/tests/test_warehouse.py
+++ b/saleor/graphql/warehouse/tests/test_warehouse.py
@@ -2,9 +2,9 @@ import graphene
import pytest
from saleor.account.models import Address
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.warehouse.error_codes import WarehouseErrorCode
from saleor.warehouse.models import Warehouse
-from tests.api.utils import get_graphql_content
QUERY_WAREHOUSES = """
query {
diff --git a/saleor/graphql/webhook/tests/test_pagination.py b/saleor/graphql/webhook/tests/test_pagination.py
index 976be738ae..0cf356ce1b 100644
--- a/saleor/graphql/webhook/tests/test_pagination.py
+++ b/saleor/graphql/webhook/tests/test_pagination.py
@@ -1,8 +1,8 @@
import pytest
from saleor.app.models import App
+from saleor.graphql.tests.utils import get_graphql_content
from saleor.webhook.models import Webhook
-from tests.api.utils import get_graphql_content
@pytest.fixture
diff --git a/saleor/graphql/webhook/tests/test_webhook.py b/saleor/graphql/webhook/tests/test_webhook.py
index cf562d3d6f..c9e1d283d5 100644
--- a/saleor/graphql/webhook/tests/test_webhook.py
+++ b/saleor/graphql/webhook/tests/test_webhook.py
@@ -4,13 +4,13 @@ import graphene
import pytest
from saleor.app.models import App
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
from saleor.graphql.webhook.enums import (
WebhookEventTypeEnum,
WebhookSampleEventTypeEnum,
)
from saleor.webhook.event_types import WebhookEventType
from saleor.webhook.models import Webhook
-from tests.api.utils import assert_no_permission, get_graphql_content
WEBHOOK_CREATE_BY_APP = """
mutation webhookCreate($name: String, $target_url: String,
diff --git a/saleor/graphql/webhook/tests/test_webhook_deprecated_service_account.py b/saleor/graphql/webhook/tests/test_webhook_deprecated_service_account.py
index 7758a85224..6798aab9c4 100644
--- a/saleor/graphql/webhook/tests/test_webhook_deprecated_service_account.py
+++ b/saleor/graphql/webhook/tests/test_webhook_deprecated_service_account.py
@@ -2,9 +2,9 @@ import graphene
import pytest
from saleor.app.models import App
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
from saleor.graphql.webhook.enums import WebhookEventTypeEnum
from saleor.webhook.models import Webhook
-from tests.api.utils import assert_no_permission, get_graphql_content
from .test_webhook import QUERY_WEBHOOKS_WITH_SORT
diff --git a/saleor/graphql/wishlist/tests/test_wishlist.py b/saleor/graphql/wishlist/tests/test_wishlist.py
index 4be52aefa4..13254fc55e 100644
--- a/saleor/graphql/wishlist/tests/test_wishlist.py
+++ b/saleor/graphql/wishlist/tests/test_wishlist.py
@@ -1,8 +1,8 @@
import graphene
import pytest
+from saleor.graphql.tests.utils import assert_no_permission, get_graphql_content
from saleor.wishlist.models import Wishlist
-from tests.api.utils import assert_no_permission, get_graphql_content
@pytest.mark.skip(reason="Wishlist temporary removed from api")