Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Use ruff instead of isort and pydocstyle
Patryk Zawadzkie46ec4b14b1d
diff --git a/.github/workflows/notify/notify-slack.py b/.github/workflows/notify/notify-slack.pyindex d35b0d4027..a7bbf8e5f7 100755--- a/.github/workflows/notify/notify-slack.py+++ b/.github/workflows/notify/notify-slack.py@@ -1,6 +1,5 @@#!/usr/bin/env python-"""-Notifies about deployment status to a given slack channel.+"""Notifies about deployment status to a given slack channel.Dependencies (already shipped by ubuntu-20.04):- Python 3.6+@@ -60,12 +59,12 @@ class JobNotifier:@propertydef run_permalink(self) -> str:- """Permalink to the current run logs"""+ """Permalink to the current run logs."""return f"https://github.com/{self.repository}/actions/runs/{self.run_id}"@propertydef job_status_color(self) -> str:- """Color from Saleor Cloud palette for job status"""+ """Color from Saleor Cloud palette for job status."""return self.JOB_STATUS_COLOR_MAP[self.job_status]def make_slack_message(self) -> dict:diff --git a/.isort.cfg b/.isort.cfgdeleted file mode 100644index e7030b0165..0000000000--- a/.isort.cfg+++ /dev/null@@ -1,11 +0,0 @@-[settings]-profile = black-skip =- .direnv- .tox- .venv- migrations- node_modules--known_first_party = saleor-known_third_party = Adyen,PIL,authorizenet,babel,before_after,boto3,botocore,braintree,celery,cryptography,dateutil,dj_database_url,dj_email_url,django,django_cache_url,django_countries,django_filters,django_measurement,django_prices,django_prices_openexchangerates,django_prices_vatlayer,draftjs_sanitizer,faker,freezegun,google,google_measurement_protocol,graphene,graphql,graphql_relay,html2text,html_to_draftjs,i18naddress,jaeger_client,jwt,kombu,lxml,markdown,measurement,micawber,mptt,oauthlib,openpyxl,opentracing,petl,phonenumber_field,phonenumbers,pkg_resources,posuto,prices,promise,pybars,pytest,pythonjsonlogger,pytimeparse,pytz,razorpay,requests,sendgrid,sentry_sdk,storages,stripe,urllib3,uvicorn,versatileimagefield,weasyprintdiff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex 5390d82346..60ae8b95bf 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -16,18 +16,6 @@ repos:- id: ruff- id: ruff-format- - repo: https://github.com/pycqa/isort- rev: 5.12.0- hooks:- - id: isort-- - repo: https://github.com/pycqa/pydocstyle- rev: 6.3.0- hooks:- - id: pydocstyle- files: ^saleor/- exclude: tests/-- repo: https://github.com/pre-commit/mirrors-mypyrev: v1.6.1hooks:diff --git a/pyproject.toml b/pyproject.tomlindex 56e3cae2a4..8c2984c86a 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -130,28 +130,10 @@ documentation = "https://docs.saleor.io/"fakeredis = "^2.10"semgrep = ">=1.34.0"-[tool.black]-target_version = [ "py35", "py36", "py37", "py38" ]-include = "\\.pyi?$"-exclude = """-/(\\.git/- |\\.eggs- |\\.hg- |__pycache__- |\\.cache- |\\.ipynb_checkpoints- |\\.mypy_cache- |\\.pytest_cache- |\\.tox- |\\.venv- |node_modules- |_build- |buck-out- |build- |dist- |media- |infrastructure- |templates- |locale-)/-"""+[tool.ruff]+extend-select = ["D", "I"]+ignore = ["D100", "D101", "D102", "D103", "D104", "D105", "D106", "D107", "D202", "D203", "D213", "D407"]+target-version = "py39"++ [tool.ruff.isort]+ known-first-party = ["saleor"]diff --git a/saleor/account/management/commands/createsuperuser.py b/saleor/account/management/commands/createsuperuser.pyindex a9dea54b3e..a3ec45b4c2 100644--- a/saleor/account/management/commands/createsuperuser.py+++ b/saleor/account/management/commands/createsuperuser.py@@ -242,10 +242,7 @@ class Command(BaseCommand):)def get_input_data(self, field, message, default=None): # noqa: D205, D212, D400, D415- """- Override this method if you want to customize data inputs or- validation exceptions.- """+ """Override this method if you want to customize data inputs or validation exceptions."""raw_value = input(message)if default and raw_value == "":raw_value = defaultdiff --git a/saleor/account/migrations/0046_user_jwt_token_key.py b/saleor/account/migrations/0046_user_jwt_token_key.pyindex cfbcd8cbec..df13a27c70 100644--- a/saleor/account/migrations/0046_user_jwt_token_key.py+++ b/saleor/account/migrations/0046_user_jwt_token_key.py@@ -1,6 +1,7 @@# Generated by Django 3.0.6 on 2020-06-08 13:24from functools import partial+import django.utils.cryptofrom django.db import migrations, modelsdiff --git a/saleor/account/migrations/0070_alter_user_uuid.py b/saleor/account/migrations/0070_alter_user_uuid.pyindex 19cc4adaa1..c84239613a 100644--- a/saleor/account/migrations/0070_alter_user_uuid.py+++ b/saleor/account/migrations/0070_alter_user_uuid.py@@ -1,8 +1,9 @@# Generated by Django 3.2.15 on 2022-08-23 07:55-from django.db import migrations, modelsimport uuid+from django.db import migrations, models+class Migration(migrations.Migration):dependencies = [diff --git a/saleor/account/migrations/0072_group.py b/saleor/account/migrations/0072_group.pyindex 4dc7f539d6..2749444d3d 100644--- a/saleor/account/migrations/0072_group.py+++ b/saleor/account/migrations/0072_group.py@@ -1,6 +1,7 @@# Generated by Django 3.2.16 on 2022-11-29 09:50from django.db import migrations, models+import saleor.account.modelsdiff --git a/saleor/account/migrations/0075_add_address_metadata.py b/saleor/account/migrations/0075_add_address_metadata.pyindex bfa06ff21c..4ab27f2a3c 100644--- a/saleor/account/migrations/0075_add_address_metadata.py+++ b/saleor/account/migrations/0075_add_address_metadata.py@@ -2,6 +2,7 @@import django.contrib.postgres.indexesfrom django.db import migrations, models+import saleor.core.utils.json_serializerdiff --git a/saleor/account/migrations/0079_full_channel_access_group_for_openid.py b/saleor/account/migrations/0079_full_channel_access_group_for_openid.pyindex 8608478a09..4498516c8d 100644--- a/saleor/account/migrations/0079_full_channel_access_group_for_openid.py+++ b/saleor/account/migrations/0079_full_channel_access_group_for_openid.py@@ -1,8 +1,8 @@# Generated by Django 3.2.18 on 2023-03-24 14:14-from django.db import migrations-from django.db.models import OuterRef, Exists, Qfrom django.apps import apps as registry+from django.db import migrations+from django.db.models import Exists, OuterRef, Qfrom django.db.models.signals import post_migrateOPENID_ID = "mirumee.authentication.openidconnect"diff --git a/saleor/account/migrations/0081_update_user_is_confirmed.py b/saleor/account/migrations/0081_update_user_is_confirmed.pyindex 0a371bd964..884d9cce1b 100644--- a/saleor/account/migrations/0081_update_user_is_confirmed.py+++ b/saleor/account/migrations/0081_update_user_is_confirmed.py@@ -1,7 +1,7 @@from django.db import migrations, transactionfrom django.db.models import QuerySet-from ..models import User+from ..models import User# Batch size of 5000 is about ~8MB of memory usageBATCH_SIZE = 5000diff --git a/saleor/account/tests/test_utils.py b/saleor/account/tests/test_utils.pyindex b8bc0d6aeb..102bc068ff 100644--- a/saleor/account/tests/test_utils.py+++ b/saleor/account/tests/test_utils.py@@ -57,8 +57,6 @@ def test_is_user_address_limit_reached_true(customer_user, address):@override_settings(MAX_USER_ADDRESSES=2)def test_is_user_address_limit_reached_false(customer_user, address):- """Ensure that false is returned when a user has less max amount- of addresses assigned."""# givencustomer_user.addresses.set([address])@@ -70,9 +68,6 @@ def test_is_user_address_limit_reached_false(customer_user, address):def test_store_user_address_uses_existing_one(address):- """Ensure storing an address that is already associated to the given user doesn't- create a new address, but uses the existing one instead.- """user = User.objects.create_user("[email protected]", "password")user.addresses.add(address)@@ -86,11 +81,6 @@ def test_store_user_address_uses_existing_one(address):def test_store_user_address_uses_existing_one_despite_duplicated(address):- """Ensure storing an address handles the possibility of an user- having the same address associated to them multiple time is handled properly.-- It should use the first identical address associated to the user.- """same_address = Address.objects.create(**address.as_data())user = User.objects.create_user("[email protected]", "password")user.addresses.set([address, same_address])@@ -105,9 +95,6 @@ def test_store_user_address_uses_existing_one_despite_duplicated(address):def test_store_user_address_create_new_address_if_not_associated(address):- """Ensure storing an address that is not associated to the given user- triggers the creation of a new address, but uses the existing one instead.- """user = User.objects.create_user("[email protected]", "password")expected_user_addresses_count = 1@@ -120,9 +107,7 @@ def test_store_user_address_create_new_address_if_not_associated(address):@override_settings(MAX_USER_ADDRESSES=2)def test_store_user_address_address_not_saved(address):- """Ensure that new address is not saved when user has already- more than 100 addressess.- """+ """Test that the address count does never exceeds the limit."""same_address = Address.objects.create(**address.as_data())user = User.objects.create_user("[email protected]", "password")user.addresses.set([address, same_address])@@ -136,8 +121,6 @@ def test_store_user_address_address_not_saved(address):def test_remove_the_oldest_user_address(customer_user, address):- """Ensure that oldest address that is not billing or shipping- default address is removed."""# givenaddresses = Address.objects.bulk_create([Address(**address.as_data()) for i in range(5)]diff --git a/saleor/app/migrations/0019_fix_constraint_names_in_app_app_permisons.py b/saleor/app/migrations/0019_fix_constraint_names_in_app_app_permisons.pyindex 1dc3619887..305ada2a25 100644--- a/saleor/app/migrations/0019_fix_constraint_names_in_app_app_permisons.py+++ b/saleor/app/migrations/0019_fix_constraint_names_in_app_app_permisons.py@@ -2,7 +2,6 @@from django.db import migrations-FIX_CONSTRAINTS = """ALTER TABLE app_app_permissionsDROP CONSTRAINT IF EXISTS account_app_permissions_app_id_a360b5e0_fk_account_app_id;diff --git a/saleor/attribute/migrations/0023_extend_reference_attr_with_variant.py b/saleor/attribute/migrations/0023_extend_reference_attr_with_variant.pyindex 0562a80a0c..25fc30a045 100644--- a/saleor/attribute/migrations/0023_extend_reference_attr_with_variant.py+++ b/saleor/attribute/migrations/0023_extend_reference_attr_with_variant.py@@ -1,7 +1,7 @@# Generated by Django 3.2.14 on 2022-08-24 11:00-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/attribute/migrations/0030_assignedproductattributevalue_product.py b/saleor/attribute/migrations/0030_assignedproductattributevalue_product.pyindex 6ab6f3af66..1c46595dd4 100644--- a/saleor/attribute/migrations/0030_assignedproductattributevalue_product.py+++ b/saleor/attribute/migrations/0030_assignedproductattributevalue_product.py@@ -1,7 +1,7 @@# Generated by Django 3.2.20 on 2023-08-23 20:21-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/attribute/migrations/0032_assignedpageattributevalue_page_add_field.py b/saleor/attribute/migrations/0032_assignedpageattributevalue_page_add_field.pyindex 585fb5853b..b9b552c87b 100644--- a/saleor/attribute/migrations/0032_assignedpageattributevalue_page_add_field.py+++ b/saleor/attribute/migrations/0032_assignedpageattributevalue_page_add_field.py@@ -1,5 +1,5 @@-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/attribute/migrations/0033_assignedpageattributevalue_page_add_index.py b/saleor/attribute/migrations/0033_assignedpageattributevalue_page_add_index.pyindex f979ee41d6..8f1d2c63f2 100644--- a/saleor/attribute/migrations/0033_assignedpageattributevalue_page_add_index.py+++ b/saleor/attribute/migrations/0033_assignedpageattributevalue_page_add_index.py@@ -1,8 +1,8 @@# Generated by Django 3.2.20 on 2023-08-24 11:25-from django.db import migrations-from django.contrib.postgres.operations import AddIndexConcurrentlyfrom django.contrib.postgres.indexes import BTreeIndex+from django.contrib.postgres.operations import AddIndexConcurrently+from django.db import migrationsclass Migration(migrations.Migration):diff --git a/saleor/attribute/migrations/0034_assignedpageattributevalue_page_data_migration.py b/saleor/attribute/migrations/0034_assignedpageattributevalue_page_data_migration.pyindex d9a1c3f997..7ba6ba8a19 100644--- a/saleor/attribute/migrations/0034_assignedpageattributevalue_page_data_migration.py+++ b/saleor/attribute/migrations/0034_assignedpageattributevalue_page_data_migration.py@@ -1,7 +1,6 @@# Generated by Django 3.2.20 on 2023-08-24 11:25-from django.db import migrations, transaction, connection-+from django.db import connection, migrations, transactionPAGE_BATCH_SIZE = 5000diff --git a/saleor/attribute/migrations/0035_assignedproductattributevalue_product_add_index.py b/saleor/attribute/migrations/0035_assignedproductattributevalue_product_add_index.pyindex b5b6d58b27..29d2bbeeb8 100644--- a/saleor/attribute/migrations/0035_assignedproductattributevalue_product_add_index.py+++ b/saleor/attribute/migrations/0035_assignedproductattributevalue_product_add_index.py@@ -1,8 +1,8 @@# Generated by Django 3.2.20 on 2023-08-24 11:25-from django.db import migrations-from django.contrib.postgres.operations import AddIndexConcurrentlyfrom django.contrib.postgres.indexes import BTreeIndex+from django.contrib.postgres.operations import AddIndexConcurrently+from django.db import migrationsclass Migration(migrations.Migration):diff --git a/saleor/attribute/migrations/0036_assignedproductattributevalue_product_data_migration.py b/saleor/attribute/migrations/0036_assignedproductattributevalue_product_data_migration.pyindex e95dd8fe0f..376c9fc22f 100644--- a/saleor/attribute/migrations/0036_assignedproductattributevalue_product_data_migration.py+++ b/saleor/attribute/migrations/0036_assignedproductattributevalue_product_data_migration.py@@ -1,7 +1,6 @@# Generated by Django 3.2.20 on 2023-08-24 11:25-from django.db import migrations, transaction, connection-+from django.db import connection, migrations, transactionPRODUCT_BATCH_SIZE = 1000diff --git a/saleor/attribute/tests/test_utils.py b/saleor/attribute/tests/test_utils.pyindex 62d05228ba..f1d1b2dcd6 100644--- a/saleor/attribute/tests/test_utils.py+++ b/saleor/attribute/tests/test_utils.py@@ -18,9 +18,6 @@ def test_associate_attribute_to_non_product_instance(color_attribute):def test_associate_attribute_to_product_instance_from_different_attribute(product, color_attribute, size_attribute):- """Ensure an assertion error is raised when one tries to associate attribute values- to an object that don't belong to the supplied attribute.- """instance = productattribute = color_attributevalue = size_attribute.values.first()diff --git a/saleor/auth/migrations/0001_initial.py b/saleor/auth/migrations/0001_initial.pyindex a74ec22297..a2fa51bba2 100644--- a/saleor/auth/migrations/0001_initial.py+++ b/saleor/auth/migrations/0001_initial.py@@ -2,8 +2,8 @@ from django.contrib.auth import validatorsfrom django.db import migrations, modelsfrom django.utils import timezone-from saleor.permission.models import PermissionManagerfrom saleor.account.models import GroupManager, UserManager+from saleor.permission.models import PermissionManagerclass Migration(migrations.Migration):diff --git a/saleor/auth/migrations/0011_update_proxy_permissions.py b/saleor/auth/migrations/0011_update_proxy_permissions.pyindex 1bb54df631..2b1ccecfcd 100644--- a/saleor/auth/migrations/0011_update_proxy_permissions.py+++ b/saleor/auth/migrations/0011_update_proxy_permissions.py@@ -15,10 +15,7 @@ WARNING = """def update_proxy_model_permissions(apps, schema_editor, reverse=False): # noqa: D205, D212, D400, D415- """- Update the content_type of proxy model permissions to use the ContentType- of the proxy model.- """+ """Update the content_type of proxy model permissions to use the ContentType of the proxy model."""style = color_style()Permission = apps.get_model("auth", "Permission")ContentType = apps.get_model("contenttypes", "ContentType")@@ -57,10 +54,7 @@ def update_proxy_model_permissions(apps, schema_editor, reverse=False): # noqa:def revert_proxy_model_permissions(apps, schema_editor): # noqa: D205, D212, D400, D415- """- Update the content_type of proxy model permissions to use the ContentType- of the concrete model.- """+ """Update the content_type of proxy model permissions to use the ContentType of the concrete model."""update_proxy_model_permissions(apps, schema_editor, reverse=True)diff --git a/saleor/channel/migrations/0001_initial.py b/saleor/channel/migrations/0001_initial.pyindex 2b86cfe180..94e6b08331 100644--- a/saleor/channel/migrations/0001_initial.py+++ b/saleor/channel/migrations/0001_initial.py@@ -1,10 +1,11 @@# Generated by Django 3.0.6 on 2020-06-16 07:54import os++from django.apps import apps as registryfrom django.conf import settingsfrom django.db import migrations, modelsfrom django.db.models.signals import post_migrate-from django.apps import apps as registrydef assign_permissions(apps, schema_editor):diff --git a/saleor/channel/migrations/0004_create_default_channel.py b/saleor/channel/migrations/0004_create_default_channel.pyindex 264cd79d89..cb8d760cde 100644--- a/saleor/channel/migrations/0004_create_default_channel.py+++ b/saleor/channel/migrations/0004_create_default_channel.py@@ -1,5 +1,5 @@-from django.db import migrationsfrom django.conf import settings+from django.db import migrationsdef create_default_channel(apps, schema_editor):diff --git a/saleor/channel/migrations/0013_auto_20230630_1039.py b/saleor/channel/migrations/0013_auto_20230630_1039.pyindex fddf84ddcc..6f63a5420a 100644--- a/saleor/channel/migrations/0013_auto_20230630_1039.py+++ b/saleor/channel/migrations/0013_auto_20230630_1039.py@@ -1,6 +1,7 @@# Generated by Django 3.2.19 on 2023-06-30 10:39from django.db import migrations, models+import saleor.core.utils.json_serializerdiff --git a/saleor/channel/migrations/0016_auto_20230816_1209.py b/saleor/channel/migrations/0016_auto_20230816_1209.pyindex 1fbf7882ff..3b28e90050 100644--- a/saleor/channel/migrations/0016_auto_20230816_1209.py+++ b/saleor/channel/migrations/0016_auto_20230816_1209.py@@ -1,7 +1,7 @@# Generated by Django 3.2.20 on 2023-08-16 12:09-from django.contrib.postgres.operations import AddIndexConcurrentlyimport django.contrib.postgres.indexes+from django.contrib.postgres.operations import AddIndexConcurrentlyfrom django.db import migrationsdiff --git a/saleor/checkout/migrations/0044_fulfill_checkout_line_new_fields.py b/saleor/checkout/migrations/0044_fulfill_checkout_line_new_fields.pyindex cbb26042db..965ac0feaf 100644--- a/saleor/checkout/migrations/0044_fulfill_checkout_line_new_fields.py+++ b/saleor/checkout/migrations/0044_fulfill_checkout_line_new_fields.py@@ -1,9 +1,9 @@# Generated by Django 3.2.13 on 2022-04-29 08:51-from django.db import migrations-from django.db.models import F, OuterRef, Subquery, Case, Whenfrom django.contrib.postgres.functions import RandomUUIDfrom django.contrib.postgres.operations import CryptoExtension+from django.db import migrations+from django.db.models import Case, F, OuterRef, Subquery, Whendef set_checkout_line_token_old_id_and_created_at(apps, _schema_editor):diff --git a/saleor/checkout/migrations/0046_alter_checkout_line_pk.py b/saleor/checkout/migrations/0046_alter_checkout_line_pk.pyindex 78a1b02e9f..a5688be11e 100644--- a/saleor/checkout/migrations/0046_alter_checkout_line_pk.py+++ b/saleor/checkout/migrations/0046_alter_checkout_line_pk.py@@ -1,8 +1,9 @@# Generated by Django 3.2.13 on 2022-04-29 09:44-from django.db import migrations, modelsimport uuid+from django.db import migrations, models+class Migration(migrations.Migration):dependencies = [diff --git a/saleor/checkout/migrations/0049_auto_20220621_0850.py b/saleor/checkout/migrations/0049_auto_20220621_0850.pyindex 34f8cfcebc..f88bfd7d24 100644--- a/saleor/checkout/migrations/0049_auto_20220621_0850.py+++ b/saleor/checkout/migrations/0049_auto_20220621_0850.py@@ -2,6 +2,7 @@import django.contrib.postgres.indexesfrom django.db import migrations, models+import saleor.core.utils.json_serializerdiff --git a/saleor/checkout/migrations/0050_auto_20220713_1057.py b/saleor/checkout/migrations/0050_auto_20220713_1057.pyindex 37ab5ebf08..d6c5f737d0 100644--- a/saleor/checkout/migrations/0050_auto_20220713_1057.py+++ b/saleor/checkout/migrations/0050_auto_20220713_1057.py@@ -1,8 +1,9 @@# Generated by Django 3.2.14 on 2022-07-13 10:57from decimal import Decimal-from django.db import migrations, models+import django.utils.timezone+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/checkout/migrations/0055_create_checkout_metadata_model.py b/saleor/checkout/migrations/0055_create_checkout_metadata_model.pyindex 9478639f86..64aa90461a 100644--- a/saleor/checkout/migrations/0055_create_checkout_metadata_model.py+++ b/saleor/checkout/migrations/0055_create_checkout_metadata_model.py@@ -1,6 +1,5 @@-from django.db import migrations, modelsimport django.contrib.postgres.indexes-+from django.db import migrations, modelsimport saleor.core.utils.json_serializerdiff --git a/saleor/checkout/migrations/0056_move_checkout_metadata_to_separate_model.py b/saleor/checkout/migrations/0056_move_checkout_metadata_to_separate_model.pyindex b985173f4c..7e5810c1d2 100644--- a/saleor/checkout/migrations/0056_move_checkout_metadata_to_separate_model.py+++ b/saleor/checkout/migrations/0056_move_checkout_metadata_to_separate_model.py@@ -1,7 +1,6 @@from django.db import migrationsfrom django.db.models import Q-BATCH_SIZE = 10000diff --git a/saleor/checkout/tests/test_checkout_complete.py b/saleor/checkout/tests/test_checkout_complete.pyindex 613ad07beb..35e0678414 100644--- a/saleor/checkout/tests/test_checkout_complete.py+++ b/saleor/checkout/tests/test_checkout_complete.py@@ -806,8 +806,6 @@ def test_create_order_gift_card_bought(is_anonymous_user,non_shippable_gift_card_product,):- """Ensure that the gift cards will be fulfilled, when newly created order- is captured."""# givencheckout_user = None if is_anonymous_user else customer_usercheckout = checkout_with_gift_card_items@@ -902,8 +900,7 @@ def test_create_order_gift_card_bought_order_not_captured_gift_cards_not_sent(shipping_method,is_anonymous_user,):- """Ensure that the gift cards will be not fulfilled, when newly created order- is not captured."""+ """Check that digital gift cards are not issued if the payment is not captured."""# givencheckout_user = None if is_anonymous_user else customer_usercheckout = checkout_with_gift_card_items@@ -1764,8 +1761,7 @@ def test_complete_checkout_invalid_shipping_method(app,payment_txn_to_confirm,):- """Ensure that when an error in _prepare_checkout_with_payment method is raised- the method for refund or void is called."""+ """Check that if _prepare_checkout_with_payment fails, the payment is refunded."""# givencheckout = checkout_ready_to_completediff --git a/saleor/checkout/tests/test_tasks.py b/saleor/checkout/tests/test_tasks.pyindex 3a17beeaf7..35ac2035e2 100644--- a/saleor/checkout/tests/test_tasks.py+++ b/saleor/checkout/tests/test_tasks.py@@ -237,9 +237,7 @@ def test_delete_expired_checkouts_no_checkouts_to_delete(checkout):@mock.patch("saleor.checkout.tasks.delete_expired_checkouts.delay")def test_delete_checkouts_until_done(mocked_task: mock.MagicMock, channel_USD):- """- Ensure the Celery task ``delete_expired_checkouts`` deletes all inactive- checkouts from the database until there are none left to delete.+ """Ensure the task deletes all inactive checkouts from the database.Given the settings:- Max 2 inactive checkouts to delete per single ``DELETE FROM`` SQL statement@@ -307,9 +305,7 @@ def test_delete_checkouts_until_done(mocked_task: mock.MagicMock, channel_USD):def test_aborts_deleting_checkouts_when_invocation_count_exhausted(mocked_task: mock.MagicMock, channel_USD):- """- Ensure the Celery task stops triggering tasks when the invocation limit is reached.- """+ """Ensure the Celery task stops triggering tasks when the invocation limit is reached."""# Create 3 empty checkouts in DBCheckout.objects.bulk_create(diff --git a/saleor/core/auth_backend.py b/saleor/core/auth_backend.pyindex 2ec5abee58..d2d259de4c 100644--- a/saleor/core/auth_backend.py+++ b/saleor/core/auth_backend.py@@ -78,18 +78,12 @@ class JSONWebTokenBackend(BaseBackend):# Moved from `django.contrib.auth.backends.ModelBackend`def get_user_permissions(self, user_obj, obj=None): # noqa: D205, D212, D400, D415- """- Return a set of permission strings the user `user_obj` has from their- `user_permissions`.- """+ """Return a set of permissions the user `user_obj` holds directly."""return self._get_permissions(user_obj, obj, "user")# Moved from `django.contrib.auth.backends.ModelBackend`def get_group_permissions(self, user_obj, obj=None): # noqa: D205, D212, D400, D415- """- Return a set of permission strings the user `user_obj` has from the- groups they belong.- """+ """Return a set of permissions the user `user_obj` gets from their groups."""return self._get_permissions(user_obj, obj, "group")# Moved from `django.contrib.auth.backends.ModelBackend`diff --git a/saleor/core/migrations/0005_alter_eventdelivery_webhook.py b/saleor/core/migrations/0005_alter_eventdelivery_webhook.pyindex a44891ebbe..01e0d860f9 100644--- a/saleor/core/migrations/0005_alter_eventdelivery_webhook.py+++ b/saleor/core/migrations/0005_alter_eventdelivery_webhook.py@@ -1,7 +1,7 @@# Generated by Django 3.2.12 on 2022-04-08 12:37-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/core/tests/test_core.py b/saleor/core/tests/test_core.pyindex a5853b8623..b731636a91 100644--- a/saleor/core/tests/test_core.py+++ b/saleor/core/tests/test_core.py@@ -55,9 +55,6 @@ type_schema = {],)def test_get_client_ip(ip_address, expected_ip):- """Test providing a valid IP in X-Forwarded-For returns the valid IP.- Otherwise, if no valid IP were found, returns the requester's IP.- """expected_ip = expected_ipheaders = {"HTTP_X_FORWARDED_FOR": ip_address} if ip_address else {}request = RequestFactory(**headers).get("/")@@ -291,9 +288,6 @@ def test_get_domain_with_public_url(site_settings, settings):def test_delete_sort_order_with_null_value(menu_item):- """Ensures there is no error when trying to delete a sortable item,- which triggers a shifting of the sort orders--which can be null."""-menu_item.sort_order = Nonemenu_item.save(update_fields=["sort_order"])menu_item.delete()diff --git a/saleor/core/tests/test_postgresql_search.py b/saleor/core/tests/test_postgresql_search.pyindex a9549b4358..838071eaee 100644--- a/saleor/core/tests/test_postgresql_search.py+++ b/saleor/core/tests/test_postgresql_search.py@@ -82,7 +82,6 @@ def gen_address_for_user(first_name, last_name):def test_combined_flat_search_vector():- """Ensure two FlatConcat can be combined into one object"""flat_vector_1 = FlatConcat(SearchVector(Value("value1"), weight="A"),SearchVector(Value("value2"), weight="C"),@@ -102,12 +101,6 @@ def test_combined_flat_search_vector():def test_flat_concat_drop_exceeding_count_no_silently_fail():- """- Ensure when the maximum allowed value count in FlatConcat is exceeded- and it shouldn't fail silently, then an exception is raised once the limit- is reached.- """-class LimitedFlatConcat(FlatConcat):max_expression_count = 2silent_drop_expression = False@@ -123,11 +116,6 @@ def test_flat_concat_drop_exceeding_count_no_silently_fail():def test_flat_concat_drop_exceeding_count_silently_truncate():- """- Ensure when the maximum allowed value count in FlatConcat is exceeded- and is set to truncate silently, the values are truncated as expected.- """-class LimitedFlatConcat(FlatConcat):max_expression_count = 2silent_drop_expression = Truediff --git a/saleor/csv/utils/products_data.py b/saleor/csv/utils/products_data.pyindex 179428b2cd..dd6c4f77ed 100644--- a/saleor/csv/utils/products_data.py+++ b/saleor/csv/utils/products_data.py@@ -5,9 +5,8 @@ from urllib.parse import urljoinimport graphenefrom django.conf import settings-from django.db.models import Case, CharField+from django.db.models import Case, CharField, Whenfrom django.db.models import Value as V-from django.db.models import Whenfrom django.db.models.functions import Cast, Concatfrom ...attribute import AttributeInputTypediff --git a/saleor/discount/migrations/0041_fulfill_orderdiscount_token_created_at_old_id.py b/saleor/discount/migrations/0041_fulfill_orderdiscount_token_created_at_old_id.pyindex fb7f891f51..71ab639a01 100644--- a/saleor/discount/migrations/0041_fulfill_orderdiscount_token_created_at_old_id.py+++ b/saleor/discount/migrations/0041_fulfill_orderdiscount_token_created_at_old_id.py@@ -1,11 +1,11 @@# Generated by Django 3.2.13 on 2022-05-02 11:06import datetime-import pytz-from django.db import migrations-from django.db.models import F, OuterRef, Subquery+import pytzfrom django.contrib.postgres.functions import RandomUUIDfrom django.contrib.postgres.operations import CryptoExtension+from django.db import migrations+from django.db.models import F, OuterRef, Subqueryfrom django.db.models.functions import Coalescediff --git a/saleor/discount/migrations/0042_migrate_orderdiscount_id_to_uuid.py b/saleor/discount/migrations/0042_migrate_orderdiscount_id_to_uuid.pyindex a3bc8c6276..5a8a50c54d 100644--- a/saleor/discount/migrations/0042_migrate_orderdiscount_id_to_uuid.py+++ b/saleor/discount/migrations/0042_migrate_orderdiscount_id_to_uuid.py@@ -1,8 +1,9 @@# Generated by Django 3.2.13 on 2022-05-02 11:13-from django.db import migrations, modelsimport uuid+from django.db import migrations, models+class Migration(migrations.Migration):dependencies = [diff --git a/saleor/discount/migrations/0043_sale_notification_sent_datetime.py b/saleor/discount/migrations/0043_sale_notification_sent_datetime.pyindex 923320f9cf..1aafc49396 100644--- a/saleor/discount/migrations/0043_sale_notification_sent_datetime.py+++ b/saleor/discount/migrations/0043_sale_notification_sent_datetime.py@@ -1,7 +1,7 @@# Generated by Django 3.2.13 on 2022-07-08 06:41-from django.db import migrations, modelsimport django.utils.timezone+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/discount/migrations/0044_auto_20230421_1018.py b/saleor/discount/migrations/0044_auto_20230421_1018.pyindex 3e16c209a8..604c8d4e4d 100644--- a/saleor/discount/migrations/0044_auto_20230421_1018.py+++ b/saleor/discount/migrations/0044_auto_20230421_1018.py@@ -1,9 +1,10 @@# Generated by Django 3.2.18 on 2023-04-21 10:18+import uuidfrom decimal import Decimal-from django.db import migrations, models+import django.db.models.deletion-import uuid+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/discount/migrations/0045_promotions.py b/saleor/discount/migrations/0045_promotions.pyindex 32aa931596..802f9d3aca 100644--- a/saleor/discount/migrations/0045_promotions.py+++ b/saleor/discount/migrations/0045_promotions.py@@ -1,11 +1,13 @@-from django.db import migrations, models+import uuid+from decimal import Decimal+import django.db.models.deletionimport django.utils.timezone+from django.db import migrations, models+import saleor.core.db.fieldsimport saleor.core.utils.editorjsimport saleor.core.utils.json_serializer-import uuid-from decimal import Decimalclass Migration(migrations.Migration):diff --git a/saleor/discount/migrations/0046_promotion_discount_indexes.py b/saleor/discount/migrations/0046_promotion_discount_indexes.pyindex 09d4a2c3fb..4f98a0f58f 100644--- a/saleor/discount/migrations/0046_promotion_discount_indexes.py+++ b/saleor/discount/migrations/0046_promotion_discount_indexes.py@@ -1,6 +1,6 @@-from django.db import migrations-from django.contrib.postgres.operations import AddIndexConcurrentlyfrom django.contrib.postgres.indexes import BTreeIndex+from django.contrib.postgres.operations import AddIndexConcurrently+from django.db import migrationsclass Migration(migrations.Migration):diff --git a/saleor/discount/migrations/0047_migrate_sales_to_promotions.py b/saleor/discount/migrations/0047_migrate_sales_to_promotions.pyindex 3747da1c1b..957ddbcd3a 100644--- a/saleor/discount/migrations/0047_migrate_sales_to_promotions.py+++ b/saleor/discount/migrations/0047_migrate_sales_to_promotions.py@@ -1,13 +1,12 @@# Generated by Django 3.2.18 on 2023-07-06 09:43-from decimal import Decimal--import graphenefrom dataclasses import dataclass+from decimal import Decimalfrom typing import Dict, List+import graphenefrom babel.numbers import get_currency_precision-from django.db import migrations, transactionfrom django.apps import apps as registry+from django.db import migrations, transactionfrom django.db.models import Exists, OuterReffrom django.db.models.signals import post_migratediff --git a/saleor/discount/migrations/0049_promotionevent.py b/saleor/discount/migrations/0049_promotionevent.pyindex 80a5259b44..ea485dadd6 100644--- a/saleor/discount/migrations/0049_promotionevent.py+++ b/saleor/discount/migrations/0049_promotionevent.py@@ -1,9 +1,11 @@# Generated by Django 3.2.20 on 2023-08-18 08:35-from django.db import migrations, models+import uuid+import django.db.models.deletion+from django.db import migrations, models+import saleor.core.utils.json_serializer-import uuidclass Migration(migrations.Migration):diff --git a/saleor/discount/migrations/0051_detach_sale_from_permission.py b/saleor/discount/migrations/0051_detach_sale_from_permission.pyindex 937c8b65b1..d42d545565 100644--- a/saleor/discount/migrations/0051_detach_sale_from_permission.py+++ b/saleor/discount/migrations/0051_detach_sale_from_permission.py@@ -1,7 +1,7 @@-from django.contrib.contenttypes.management import create_contenttypes-from django.db import DEFAULT_DB_ALIAS, migrationsfrom django.apps import apps as global_appsfrom django.contrib.auth import get_permission_codename+from django.contrib.contenttypes.management import create_contenttypes+from django.db import DEFAULT_DB_ALIAS, migrationsdef handle_permissions(apps, _schema_editor):diff --git a/saleor/giftcard/migrations/0020_search_vector_index.py b/saleor/giftcard/migrations/0020_search_vector_index.pyindex 4f99263d0f..85eb50d8f8 100644--- a/saleor/giftcard/migrations/0020_search_vector_index.py+++ b/saleor/giftcard/migrations/0020_search_vector_index.py@@ -1,7 +1,7 @@# Generated by Django 3.2.18 on 2023-06-26 13:28-from django.contrib.postgres.operations import AddIndexConcurrentlyimport django.contrib.postgres.indexes+from django.contrib.postgres.operations import AddIndexConcurrentlyfrom django.db import migrationsdiff --git a/saleor/graphql/account/tests/bulk_mutations/test_staff_bulk_delete.py b/saleor/graphql/account/tests/bulk_mutations/test_staff_bulk_delete.pyindex 05e9be1142..9707bcb2c4 100644--- a/saleor/graphql/account/tests/bulk_mutations/test_staff_bulk_delete.py+++ b/saleor/graphql/account/tests/bulk_mutations/test_staff_bulk_delete.py@@ -164,9 +164,6 @@ def test_delete_staff_members_superuser_can_delete_when_delete_left_notmanageablpermission_manage_users,permission_manage_orders,):- """Ensure that superuser can delete users even when not all permissions which be- manageable by other users.- """query = STAFF_BULK_DELETE_MUTATIONgroups = Group.objects.bulk_create(@@ -320,8 +317,6 @@ def test_delete_staff_members_superuser_can_delete__out_of_scope_users(permission_manage_users,permission_manage_orders,):- """Ensure superuser can delete users when- some users has wider scope of permissions."""query = STAFF_BULK_DELETE_MUTATIONgroups = Group.objects.bulk_create(diff --git a/saleor/graphql/account/tests/mutations/account/test_account_address_create.py b/saleor/graphql/account/tests/mutations/account/test_account_address_create.pyindex f9a394ba48..ab36639379 100644--- a/saleor/graphql/account/tests/mutations/account/test_account_address_create.py+++ b/saleor/graphql/account/tests/mutations/account/test_account_address_create.py@@ -145,8 +145,6 @@ def test_customer_create_default_address(user_api_client, graphql_address_data):def test_customer_create_address_the_oldest_address_is_deleted(user_api_client, graphql_address_data, address):- """Ensure that when mew address it added to user with max amount of addressess,- the oldest address will be removed."""user = user_api_client.usersame_address = Address.objects.create(**address.as_data())user.addresses.set([address, same_address])diff --git a/saleor/graphql/account/tests/mutations/permission_group/test_permission_group_create.py b/saleor/graphql/account/tests/mutations/permission_group/test_permission_group_create.pyindex fbc8fa7c57..037fc1dcb4 100644--- a/saleor/graphql/account/tests/mutations/permission_group/test_permission_group_create.py+++ b/saleor/graphql/account/tests/mutations/permission_group/test_permission_group_create.py@@ -311,9 +311,6 @@ def test_permission_group_create_mutation_lack_of_permission(permission_group_manage_orders,permission_group_all_perms_all_channels,):- """Ensue staff user can't create group with wider scope of permissions.- Ensure that superuser pass restrictions.- """staff_user.groups.add(permission_group_manage_orders)query = PERMISSION_GROUP_CREATE_MUTATIONname = "New permission group"@@ -411,12 +408,6 @@ def test_permission_group_create_mutation_add_customer_user(permission_group_manage_apps,permission_group_all_perms_all_channels,):- """Ensure creating permission group with customer user in input field for adding- users failed. Mutations should failed. Error should contains list of wrong users- IDs.- Ensure this mutation also fail for superuser.- """-second_customer = User.objects.create(email="[email protected]", password="test")@@ -522,10 +513,6 @@ def test_permission_group_create_mutation_requestor_does_not_have_all_users_permstaff_api_client,permission_group_manage_apps,):- """Ensure user can create group with user whose permission scope- is wider than requestor scope.- """-staff_user = staff_users[0]staff_user.groups.add(permission_group_manage_apps)permission_group_manage_users.user_set.add(staff_users[1])@@ -613,8 +600,6 @@ def test_permission_group_create_mutation_not_restricted_channels(channel_PLN,channel_USD,):- """Ensure that creating permission group with restrictedAccessToChannels se to- False won't assign any channels to the group."""# givenpermission_group_no_perms_all_channels.user_set.add(staff_api_client.user)query = PERMISSION_GROUP_CREATE_MUTATION@@ -652,8 +637,6 @@ def test_permission_group_create_mutation_not_restricted_channels_no_access(channel_PLN,channel_USD,):- """Ensure that user with restricted channel access is not able to create a group- with not restricted channel access."""# givenpermission_group_all_perms_channel_USD_only.user_set.add(staff_api_client.user)query = PERMISSION_GROUP_CREATE_MUTATIONdiff --git a/saleor/graphql/account/tests/mutations/permission_group/test_permission_group_delete.py b/saleor/graphql/account/tests/mutations/permission_group/test_permission_group_delete.pyindex 57e05c0f60..4c493af013 100644--- a/saleor/graphql/account/tests/mutations/permission_group/test_permission_group_delete.py+++ b/saleor/graphql/account/tests/mutations/permission_group/test_permission_group_delete.py@@ -181,9 +181,6 @@ def test_group_delete_mutation_out_of_scope_permission(staff_api_client,superuser_api_client,):- """Ensure staff user can't delete group which is out of user's permission scope.- Ensure superuser pass restrictions.- """group = permission_group_manage_usersquery = PERMISSION_GROUP_DELETE_MUTATION@@ -221,10 +218,6 @@ def test_group_delete_mutation_left_not_manageable_permission(staff_api_client,superuser_api_client,):- """Ensure staff user can't delete group when some permissions will be not- manageable.- Ensure superuser pass restrictions.- """staff_user, staff_user1, staff_user2 = staff_usersstaff_user.user_permissions.add(permission_manage_orders, permission_manage_productsdiff --git a/saleor/graphql/account/tests/mutations/permission_group/test_permission_group_update.py b/saleor/graphql/account/tests/mutations/permission_group/test_permission_group_update.pyindex 34af5e9f43..8b1d7228cd 100644--- a/saleor/graphql/account/tests/mutations/permission_group/test_permission_group_update.py+++ b/saleor/graphql/account/tests/mutations/permission_group/test_permission_group_update.py@@ -778,9 +778,6 @@ def test_permission_group_update_mutation_with_name_which_exists(staff_user,staff_api_client,):- """Ensure mutation failed where updating name with value which already is a name of- different group.- """staff_user.groups.add(permission_group_manage_staff, permission_group_manage_users)group = permission_group_manage_usersold_group_name = group.name@@ -877,10 +874,6 @@ def test_permission_group_update_mutation_user_cannot_manage_group(superuser_api_client,permission_group_manage_apps,):- """Ensure that update mutation failed when user try to update group for which- he doesn't have permission.- Ensure superuser pass restrictions.- """staff_user.groups.add(permission_group_manage_apps)group = permission_group_manage_usersquery = PERMISSION_GROUP_UPDATE_MUTATION@@ -932,10 +925,6 @@ def test_permission_group_update_mutation_user_in_list_to_add_and_remove(permission_group_manage_users,permission_group_manage_apps,):- """Ensure update mutation failed when user IDs are in both lists for adding- and removing. Ensure mutation contains list of user IDs which cause- the problem.- """staff_user = staff_users[0]staff_user.groups.add(permission_group_manage_users, permission_group_manage_apps)group = permission_group_manage_users@@ -975,10 +964,6 @@ def test_permission_group_update_mutation_permissions_in_list_to_add_and_remove(permission_group_manage_apps,permission_group_manage_orders,):- """Ensure update mutation failed when permission items are in both lists for- adding and removing. Ensure mutation contains list of permissions which cause- the problem.- """staff_user.groups.add(permission_group_manage_users,permission_group_manage_apps,@@ -1021,10 +1006,6 @@ def test_permission_group_update_mutation_permissions_and_users_duplicated(permission_group_manage_apps,permission_group_manage_orders,):- """Ensure updating mutations with the same permission and users in list for- adding and removing failed. Mutation should failed. Error should contains list of- users IDs and permissions that are duplicated.- """staff_user = staff_users[0]staff_user.groups.add(permission_group_manage_users,@@ -1079,10 +1060,6 @@ def test_permission_group_update_mutation_user_add_customer_user(permission_group_manage_apps,customer_user,):- """Ensure update mutation with customer user in field for adding users failed.- Ensure error contains list with user IDs which cause the problem.- Ensure it also fail for superuser.- """staff_user.groups.add(permission_group_manage_users, permission_group_manage_apps)group = permission_group_manage_usersquery = PERMISSION_GROUP_UPDATE_MUTATION@@ -1136,10 +1113,6 @@ def test_permission_group_update_mutation_lack_of_permission(permission_group_manage_apps,permission_manage_orders,):- """Ensure update mutation failed when user trying to add permission which- he doesn't have.- Ensure superuser pass the restrictions.- """staff_user.groups.add(permission_group_manage_users, permission_group_manage_apps)group = permission_group_manage_usersquery = PERMISSION_GROUP_UPDATE_MUTATION@@ -1199,11 +1172,6 @@ def test_permission_group_update_mutation_out_of_scope_users(permission_manage_orders,permission_manage_products,):- """Ensure user can assign and cannot unasign users whose permission scope- is wider than requestor scope.- Ensure superuser pass restrictions.- """-staff_user = staff_users[0]staff_user3 = User.objects.create_user(email="[email protected]",@@ -1282,10 +1250,6 @@ def test_permission_group_update_mutation_duplicated_channels(channel_USD,channel_JPY,):- """Ensure update mutation failed when channel IDs are in both lists for adding- and removing. Ensure mutation contains list of channel IDs which cause- the problem.- """# givenstaff_user.groups.add(permission_group_manage_users,@@ -1341,12 +1305,6 @@ def test_permission_group_update_mutation_multiple_errors(permission_group_manage_apps,permission_manage_orders,):- """Ensure update mutation failed with all validation errors when input data- is incorrent:- - adding permission which user hasn't (OUT_OF_SCOPE_PERMISSION)- - adding customer user (ASSIGN_NON_STAFF_MEMBER)- """-staff_user.groups.add(permission_group_manage_apps, permission_group_manage_users)group = permission_group_manage_usersquery = PERMISSION_GROUP_UPDATE_MUTATION@@ -1378,27 +1336,30 @@ def test_permission_group_update_mutation_multiple_errors(assert len(errors) == 3expected_errors = [{+ "channels": None,"code": "OUT_OF_SCOPE_PERMISSION","field": "addPermissions",- "permissions": [OrderPermissions.MANAGE_ORDERS.codename],+ "permissions": [OrderPermissions.MANAGE_ORDERS.name],"users": None,},{+ "channels": None,"code": "ASSIGN_NON_STAFF_MEMBER","field": "addUsers","permissions": None,- "users": user_ids[1],+ "users": [user_ids[1]],},{+ "channels": None,"code": "LEFT_NOT_MANAGEABLE_PERMISSION","field": "removeUsers",- "permissions": None,- "users": user_ids[0],+ "permissions": [AccountPermissions.MANAGE_USERS.name],+ "users": None,},]for error in errors:error.pop("message")- error in expected_errors+ assert error in expected_errorsassert data["group"] is None@@ -1411,8 +1372,6 @@ def test_permission_group_update_mutation_remove_all_users_manageable_perms(permission_manage_users,staff_api_client,):- """Ensure that user can remove group users if there is other source of all group- permissions."""staff_user, staff_user1, staff_user2 = staff_usersgroups = Group.objects.bulk_create(@@ -1463,10 +1422,6 @@ def test_permission_group_update_mutation_remove_all_group_users_not_manageable_staff_api_client,superuser_api_client,):- """Ensure that user cannot remove group users if there is no other source of some- of group permission.- Ensure superuser pass restrictions.- """staff_user, staff_user1, staff_user2 = staff_usersgroups = Group.objects.bulk_create(@@ -1531,9 +1486,6 @@ def test_permission_group_update_mutation_remove_group_users_add_with_manage_stupermission_manage_users,staff_api_client,):- """Ensure that user can remove all group users when adding somebody with- manage staff permission.- """staff_user, staff_user1, staff_user2 = staff_usersgroups = Group.objects.bulk_create(@@ -1578,9 +1530,6 @@ def test_group_update_mutation_remove_some_users_from_group_with_manage_staff(permission_manage_staff,staff_api_client,):- """Ensure that user can remove some of user group if group has manage- staff permission.- """staff_user, staff_user1, staff_user2 = staff_usersgroup = permission_group_manage_usersstaff_user.groups.add(permission_group_manage_users, permission_group_manage_staff)@@ -1616,10 +1565,6 @@ def test_group_update_mutation_remove_some_users_from_group_user_with_manage_stustaff_api_client,permission_manage_orders,):- """Ensure that user can remove some of user group from group without manage staff- permission but some of the group member has manage staff permission from- another source.- """staff_user, staff_user1, staff_user2 = staff_usersgroups = Group.objects.bulk_create(@@ -1662,8 +1607,6 @@ def test_permission_group_update_mutation_remove_user_with_manage_staff(permission_manage_orders,staff_api_client,):- """Ensure user cannot remove users with manage staff permission from group if some- permission will be no more manageable."""staff_user, staff_user1, staff_user2 = staff_usersgroups = Group.objects.bulk_create(@@ -1713,9 +1656,6 @@ def test_permission_group_update_mutation_remove_user_with_manage_staff_add_userpermission_manage_orders,staff_api_client,):- """Ensure user can remove users with manage staff if user with manage staff- will be added.- """staff_user, staff_user1, staff_user2 = staff_usersgroups = Group.objects.bulk_create(diff --git a/saleor/graphql/account/tests/mutations/staff/test_customer_delete.py b/saleor/graphql/account/tests/mutations/staff/test_customer_delete.pyindex a7d60959fa..bc8ff065b1 100644--- a/saleor/graphql/account/tests/mutations/staff/test_customer_delete.py+++ b/saleor/graphql/account/tests/mutations/staff/test_customer_delete.py@@ -39,9 +39,6 @@ def test_customer_delete(permission_manage_users,media_root,):- """Ensure deleting a customer actually deletes the customer and creates proper- related events"""-query = CUSTOMER_DELETE_MUTATIONcustomer_id = graphene.Node.to_global_id("User", customer_user.pk)customer_user.avatar = image@@ -117,9 +114,6 @@ def test_customer_delete_by_app(permission_manage_users,media_root,):- """Ensure deleting a customer actually deletes the customer and creates proper- related events"""-query = CUSTOMER_DELETE_MUTATIONcustomer_id = graphene.Node.to_global_id("User", customer_user.pk)customer_user.avatar = imagediff --git a/saleor/graphql/account/tests/mutations/staff/test_staff_create.py b/saleor/graphql/account/tests/mutations/staff/test_staff_create.pyindex 2ede63a49c..d8591c23f5 100644--- a/saleor/graphql/account/tests/mutations/staff/test_staff_create.py+++ b/saleor/graphql/account/tests/mutations/staff/test_staff_create.py@@ -301,9 +301,6 @@ def test_staff_create_out_of_scope_group(channel_PLN,site_settings,):- """Ensure user can't create staff with groups which are out of user scope.- Ensure superuser pass restrictions.- """group = permission_group_manage_usersgroup2 = Group.objects.create(name="second group")group2.permissions.add(permission_manage_staff)diff --git a/saleor/graphql/account/tests/mutations/staff/test_staff_delete.py b/saleor/graphql/account/tests/mutations/staff/test_staff_delete.pyindex b613b14c84..0cba38faef 100644--- a/saleor/graphql/account/tests/mutations/staff/test_staff_delete.py+++ b/saleor/graphql/account/tests/mutations/staff/test_staff_delete.py@@ -142,10 +142,6 @@ def test_staff_delete_out_of_scope_user(permission_manage_staff,permission_manage_products,):- """Ensure staff user cannot delete users even when some of user permissions are- out of requestor scope.- Ensure superuser pass restrictions.- """query = STAFF_DELETE_MUTATIONstaff_user = User.objects.create(email="[email protected]", is_staff=True)staff_user.user_permissions.add(permission_manage_products)@@ -180,9 +176,6 @@ def test_staff_delete_left_not_manageable_permissions(permission_manage_users,permission_manage_orders,):- """Ensure staff user can't and superuser can delete staff user when some of- permissions will be not manageable.- """query = STAFF_DELETE_MUTATIONgroups = Group.objects.bulk_create([diff --git a/saleor/graphql/account/tests/mutations/staff/test_staff_update.py b/saleor/graphql/account/tests/mutations/staff/test_staff_update.pyindex 21ab1bdc27..02c7bb00ff 100644--- a/saleor/graphql/account/tests/mutations/staff/test_staff_update.py+++ b/saleor/graphql/account/tests/mutations/staff/test_staff_update.py@@ -289,9 +289,6 @@ def test_staff_update_out_of_scope_user(permission_manage_orders,media_root,):- """Ensure that staff user cannot update user with wider scope of permission.- Ensure superuser pass restrictions.- """query = STAFF_UPDATE_MUTATIONSstaff_user = User.objects.create(email="[email protected]", is_staff=True)staff_user.user_permissions.add(permission_manage_orders)@@ -327,10 +324,6 @@ def test_staff_update_out_of_scope_groups(permission_manage_orders,permission_manage_products,):- """Ensure that staff user cannot add to groups which permission scope is wider- than user's scope.- Ensure superuser pass restrictions.- """query = STAFF_UPDATE_MUTATIONSgroups = Group.objects.bulk_create(@@ -487,9 +480,6 @@ def test_staff_update_deactivate_with_manage_staff_left_not_manageable_perms(permission_manage_orders,media_root,):- """Ensure that staff user can't and superuser can deactivate user where some- permissions will be not manageable.- """query = STAFF_UPDATE_MUTATIONSgroups = Group.objects.bulk_create([diff --git a/saleor/graphql/account/tests/queries/test_account_events.py b/saleor/graphql/account/tests/queries/test_account_events.pyindex 21b1766d6f..dfc41a94da 100644--- a/saleor/graphql/account/tests/queries/test_account_events.py+++ b/saleor/graphql/account/tests/queries/test_account_events.py@@ -316,9 +316,6 @@ def test_account_event_customer_deleted_event_resolves_properly(def test_account_invalid_or_deleted_order_line_return_null(staff_api_client, permission_manage_users, customer_user, order_line):- """Ensure getting an order line does return null if it is no longer existing,- despite the fact it *shouldn't* happen in production."""-# Prepare teststaff_api_client.user.user_permissions.add(permission_manage_users)diff --git a/saleor/graphql/account/tests/test_account_utils.py b/saleor/graphql/account/tests/test_account_utils.pyindex feb42073ba..27b679f64a 100644--- a/saleor/graphql/account/tests/test_account_utils.py+++ b/saleor/graphql/account/tests/test_account_utils.py@@ -676,9 +676,6 @@ def test_get_not_manageable_permissions_after_group_deleting_some_cannot_be_manadef test_get_not_manageable_permissions_removing_users_from_group(staff_users, permission_group_manage_users, permission_manage_staff):- """Ensure not returning permission when some of users stay in group and groups has- manage staff permission.- """group = permission_group_manage_usersgroup.permissions.add(permission_manage_staff)group.user_set.add(*staff_users)@@ -693,9 +690,6 @@ def test_get_not_manageable_permissions_removing_users_from_group(def test_get_not_manageable_perms_removing_users_from_group_user_from_group_can_manage(staff_users, permission_manage_users, permission_manage_staff):- """Ensure not returning permission for group without manage staff permission when- some of remaining users from group has manage staff permission from other source.- """groups = Group.objects.bulk_create([Group(name="manage users"), Group(name="manage staff")])@@ -718,9 +712,6 @@ def test_get_not_manageable_perms_removing_users_from_group_user_from_group_can_def test_get_notmanageable_perms_removing_users_from_group_user_out_of_group_can_manage(staff_users, permission_manage_users, permission_manage_staff):- """Ensure not returning permission for group, when manageable of all permissions are- ensure by other groups.- """groups = Group.objects.bulk_create([Group(name="manage users"), Group(name="manage staff and users")])@@ -746,9 +737,6 @@ def test_get_not_manageable_perms_removing_users_from_group_some_cannot_be_managpermission_manage_staff,permission_manage_orders,):- """Ensure returning permission for group, when manageable of all permissions are not- ensure by other groups.- """groups = Group.objects.bulk_create([Group(name="manage users"),@@ -780,8 +768,6 @@ def test_get_not_manageable_permissions_when_deactivate_or_remove_user_no_permispermission_manage_staff,permission_manage_orders,):- """Ensure user can be deactivated or removed when manageable of all permissions are- ensure by other users."""groups = Group.objects.bulk_create([Group(name="manage users"),@@ -813,8 +799,6 @@ def test_get_not_manageable_permissions_when_deactivate_or_remove_users_some_perpermission_manage_staff,permission_manage_orders,):- """Ensure user cannot be deactivated or removed when manageable of all permissions- are not ensure by other users."""groups = Group.objects.bulk_create([Group(name="manage users"),@@ -915,8 +899,6 @@ def test_get_not_manageable_permissions_after_removing_perms_from_group_some_canpermission_manage_staff,permission_manage_orders,):- """Ensure permissions are returned when not all perms will be manageable after- removing permissions from group."""groups = Group.objects.bulk_create([Group(name="manage users and products"),diff --git a/saleor/graphql/account/tests/utils.py b/saleor/graphql/account/tests/utils.pyindex a0bb610214..17ba383be1 100644--- a/saleor/graphql/account/tests/utils.py+++ b/saleor/graphql/account/tests/utils.py@@ -2,10 +2,10 @@ from ...core.utils import snake_to_camel_casedef convert_dict_keys_to_camel_case(d):- """Changes dict fields from d[field_name] to d[fieldName].+ """Change dict fields from snake_case to camelCase.Useful when dealing with dict data such as address that need to be parsed- into graphql input.+ into GraphQL input."""data = {}for k, v in d.items():diff --git a/saleor/graphql/attribute/tests/mutations/test_attribute_value_create.py b/saleor/graphql/attribute/tests/mutations/test_attribute_value_create.pyindex 13de989804..40a155f92f 100644--- a/saleor/graphql/attribute/tests/mutations/test_attribute_value_create.py+++ b/saleor/graphql/attribute/tests/mutations/test_attribute_value_create.py@@ -188,8 +188,6 @@ def test_create_attribute_value_with_the_same_name_as_different_attribute_value(color_attribute,permission_manage_products,):- """Ensure the attribute value with the same slug as value of different attribute- can be created."""# givenattribute = attribute_without_valuesquery = CREATE_ATTRIBUTE_VALUE_MUTATIONdiff --git a/saleor/graphql/attribute/tests/mutations/test_attribute_value_update.py b/saleor/graphql/attribute/tests/mutations/test_attribute_value_update.pyindex 48ce3536b1..195409ef9a 100644--- a/saleor/graphql/attribute/tests/mutations/test_attribute_value_update.py+++ b/saleor/graphql/attribute/tests/mutations/test_attribute_value_update.py@@ -217,8 +217,6 @@ def test_update_attribute_value_the_same_name_as_different_attribute_value(color_attribute,permission_manage_product_types_and_attributes,):- """Ensure the attribute value with the same slug as value of different attribute- can be set."""# givenquery = UPDATE_ATTRIBUTE_VALUE_MUTATIONdiff --git a/saleor/graphql/attribute/tests/queries/test_attribute_filter.py b/saleor/graphql/attribute/tests/queries/test_attribute_filter.pyindex 6003efc2c7..bf42130cbd 100644--- a/saleor/graphql/attribute/tests/queries/test_attribute_filter.py+++ b/saleor/graphql/attribute/tests/queries/test_attribute_filter.py@@ -1112,10 +1112,6 @@ def test_filter_attributes_by_product_type(def test_attributes_filter_by_product_type_with_empty_value():- """Ensure passing an empty or null value is ignored and the queryset is simply- returned without any modification.- """-qs = Attribute.objects.all()assert filter_attributes_by_product_types(qs, "...", "", None, None) is qs@@ -1125,10 +1121,6 @@ def test_attributes_filter_by_product_type_with_empty_value():def test_attributes_filter_by_product_type_with_unsupported_field(customer_user, channel_USD):- """Ensure using an unknown field to filter attributes by raises a NotImplemented- exception.- """-qs = Attribute.objects.all()with pytest.raises(NotImplementedError) as exc:diff --git a/saleor/graphql/attribute/tests/queries/test_attribute_query.py b/saleor/graphql/attribute/tests/queries/test_attribute_query.pyindex 239c2ae03c..fdc0bc0985 100644--- a/saleor/graphql/attribute/tests/queries/test_attribute_query.py+++ b/saleor/graphql/attribute/tests/queries/test_attribute_query.py@@ -565,9 +565,6 @@ def test_retrieving_the_restricted_attributes_restricted(attribute,expected_value,):- """Checks if the attributes are restricted and if their default value- is the expected one."""-attribute = to_camel_case(attribute)query = ("""diff --git a/saleor/graphql/attribute/tests/test_utils.py b/saleor/graphql/attribute/tests/test_utils.pyindex f4384b9905..956d54e90a 100644--- a/saleor/graphql/attribute/tests/test_utils.py+++ b/saleor/graphql/attribute/tests/test_utils.py@@ -2102,7 +2102,8 @@ def test_prepare_attribute_values_prefer_the_slug_match(color_attribute):"""Ensure that the value with slug match is returned as the first choice.When the value with the matching slug is not found, the value with the matching- name is returned."""+ name is returned.+ """# givenexisting_value = color_attribute.values.first()second_val = color_attribute.values.create(@@ -2133,7 +2134,8 @@ def test_prepare_attribute_values_that_gives_the_same_slug(color_attribute):"""Ensure that the unique slug for all values is created.Ensure that when providing the two or more values that are giving the same slug- the integrity error is not raised."""+ the integrity error is not raised.+ """# givenexisting_value = color_attribute.values.first()attr_values_count = color_attribute.values.count()diff --git a/saleor/graphql/checkout/tests/mutations/test_checkout_add_promo_code.py b/saleor/graphql/checkout/tests/mutations/test_checkout_add_promo_code.pyindex e38bc264d3..d971842a26 100644--- a/saleor/graphql/checkout/tests/mutations/test_checkout_add_promo_code.py+++ b/saleor/graphql/checkout/tests/mutations/test_checkout_add_promo_code.py@@ -1276,9 +1276,6 @@ def test_checkout_add_free_shipping_voucher_do_not_invalidate_shipping_method(shipping_method,address_usa,):- """Ensure that adding free shipping voucher do not invalidate- current shipping method.- """checkout_with_item.shipping_method = shipping_methodcheckout_with_item.shipping_address = address_usacheckout_with_item.save(update_fields=["shipping_method", "shipping_address"])diff --git a/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_payment.py b/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_payment.pyindex 8ea6037bfb..7dee825fd9 100644--- a/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_payment.py+++ b/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_payment.py@@ -413,8 +413,6 @@ def test_checkout_complete_with_metadata_checkout_without_metadata(address,shipping_method,):- """Ensure that checkout is properly completed with provided metadata when the- checkout object hasn't assigned any metadata."""# givenassert not gift_card.last_used_on@@ -3000,8 +2998,7 @@ def test_complete_checkout_for_global_click_and_collect(warehouse_for_cc,warehouse,):- """Ensure that the allocation is made for collection point warehouse even if another- warehouse with bigger quantity available exist."""+ """Test that click-and-collect prefers the local stock even if other warehouses hold more stock."""# givenorder_count = Order.objects.count()checkout = checkout_with_item_for_ccdiff --git a/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_transactions.py b/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_transactions.pyindex 16b24e2d26..3452fee07f 100644--- a/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_transactions.py+++ b/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_transactions.py@@ -2629,9 +2629,7 @@ def test_complete_checkout_for_global_click_and_collect(transaction_events_generator,transaction_item_generator,):- """Ensure that the allocation is made for collection point warehouse even if another- warehouse with bigger quantity available exist."""-+ """Test that click-and-collect prefers the local stock even if other warehouses hold more stock."""# givencheckout = prepare_checkout_for_test(checkout_with_item_for_cc,diff --git a/saleor/graphql/checkout/tests/mutations/test_checkout_create.py b/saleor/graphql/checkout/tests/mutations/test_checkout_create.pyindex 62e8d77b71..414858fbbf 100644--- a/saleor/graphql/checkout/tests/mutations/test_checkout_create.py+++ b/saleor/graphql/checkout/tests/mutations/test_checkout_create.py@@ -631,8 +631,6 @@ def test_checkout_create_with_custom_price_duplicated_items(channel_USD,permission_handle_checkouts,):- """Ensure that when the same item with a custom price is provided multiple times,- the price from the last occurrence will be set."""variant = stock.product_variantvariant_id = graphene.Node.to_global_id("ProductVariant", variant.id)test_email = "[email protected]"@@ -1406,9 +1404,6 @@ def test_checkout_create_check_lines_quantity_for_zone_insufficient_stocks(graphql_address_data,channel_USD,):- """Check if insufficient stock exception will be raised.- If item from checkout will not have enough quantity in correct shipping zone for- shipping address INSUFICIENT_STOCK checkout error should be raised."""variant = variant_with_many_stocks_different_shipping_zonesStock.objects.filter(warehouse__shipping_zones__countries__contains="US", product_variant=variantdiff --git a/saleor/graphql/checkout/tests/mutations/test_checkout_lines_add.py b/saleor/graphql/checkout/tests/mutations/test_checkout_lines_add.pyindex 6ed69027bb..b21ab9698a 100644--- a/saleor/graphql/checkout/tests/mutations/test_checkout_lines_add.py+++ b/saleor/graphql/checkout/tests/mutations/test_checkout_lines_add.py@@ -338,8 +338,7 @@ def test_checkout_lines_add_with_new_variant_and_metadata(def test_checkout_lines_add_only_stock_in_cc_warehouse(mocked_update_shipping_method, user_api_client, checkout_with_item, warehouse_for_cc):- """Ensure the line can be added to the checkout when the only available quantity- is in a stock from the collection point warehouse without shipping zone assigned."""+ """Test that click-and-collect quantities are available if no shipping method is set."""# givencheckout = checkout_with_item@@ -387,9 +386,8 @@ def test_checkout_lines_add_only_stock_in_cc_warehouse(def test_checkout_lines_add_only_stock_in_cc_warehouse_delivery_method_set(user_api_client, checkout_with_item, warehouse_for_cc, shipping_method):- """Ensure the insufficient error is raised when the only available quantity is in- a stock from the collection point warehouse without shipping zone assigned- and the checkout has shipping method set."""+ """Test that click-and-collect quantities are unavailable if a non-C&C shipping method is set."""+# givencheckout = checkout_with_itemdiff --git a/saleor/graphql/checkout/tests/mutations/test_checkout_lines_update.py b/saleor/graphql/checkout/tests/mutations/test_checkout_lines_update.pyindex ff068cac64..cb667bd077 100644--- a/saleor/graphql/checkout/tests/mutations/test_checkout_lines_update.py+++ b/saleor/graphql/checkout/tests/mutations/test_checkout_lines_update.py@@ -267,8 +267,7 @@ def test_checkout_lines_update_block_when_variant_id_and_line_id_provided(def test_checkout_lines_update_only_stock_in_cc_warehouse(mocked_update_shipping_method, user_api_client, checkout_with_item, warehouse_for_cc):- """Ensure the insufficient error is not raised when the only available quantity- is in a stock from the collection point warehouse without shipping zone assigned."""+ """Test that click-and-collect quantities are available if no shipping method is set."""# givencheckout = checkout_with_itemlines, _ = fetch_checkout_lines(checkout)@@ -317,11 +316,8 @@ def test_checkout_lines_update_only_stock_in_cc_warehouse(def test_checkout_lines_update_only_stock_in_cc_warehouse_delivery_method_set(user_api_client, checkout_with_item, warehouse_for_cc, shipping_method-):- """Ensure the insufficient error is raised when the only available quantity is in- a stock from the collection point warehouse without shipping zone assigned- and the checkout has shipping method set."""- # given+): # given+ """Test that click-and-collect quantities are unavailable if a non-C&C shipping method is set."""checkout = checkout_with_itemline = checkout.lines.first()variant = line.variant@@ -357,8 +353,6 @@ def test_checkout_lines_update_only_stock_in_cc_warehouse_delivery_method_set(def test_checkout_lines_update_checkout_with_voucher(user_api_client, checkout_with_item, voucher_percentage):- """Ensure that discount is correct calculated when updating the checkout with- already applied discount."""# givenchannel = checkout_with_item.channelline = checkout_with_item.lines.first()@@ -705,9 +699,6 @@ def test_checkout_lines_update_clear_custom_price(def test_checkout_lines_update_set_quantity_to_0_then_update_customer_price(app_api_client, checkout_with_item, permission_handle_checkouts):- """Ensure an error is not raised and the line is deleted when the line quantity- is set to 0 firstly and then the custom price is changed."""-checkout = checkout_with_itemlines, _ = fetch_checkout_lines(checkout)assert checkout.lines.count() == 1diff --git a/saleor/graphql/checkout/tests/test_checkout.py b/saleor/graphql/checkout/tests/test_checkout.pyindex 77970412c5..0050a40877 100644--- a/saleor/graphql/checkout/tests/test_checkout.py+++ b/saleor/graphql/checkout/tests/test_checkout.py@@ -582,8 +582,6 @@ def test_checkout_shipping_methods_with_price_based_shipping_method_and_discountaddress,shipping_method,):- """Ensure that price based shipping method is not returned when- checkout with discounts subtotal is lower than minimal order price."""checkout_with_item.shipping_address = addressmanager = get_plugins_manager()lines, _ = fetch_checkout_lines(checkout_with_item)@@ -625,8 +623,7 @@ def test_checkout_shipping_methods_with_price_based_shipping_and_shipping_discoushipping_method,voucher_shipping_type,):- """Ensure that price based shipping method is returned when checkout- has discount on shipping."""+ """Test that shipping discounts properly qualify checkout for price-based shipping."""checkout_with_item.shipping_address = addressmanager = get_plugins_manager()lines, _ = fetch_checkout_lines(checkout_with_item)@@ -667,10 +664,7 @@ def test_checkout_shipping_methods_with_price_based_shipping_and_shipping_discoudef test_checkout_shipping_methods_with_price_based_method_and_product_voucher(api_client, checkout_with_item, address, shipping_method, voucher, channel_USD):- """Ensure that price based shipping method is returned when- checkout with discounts subtotal is lower than maximal order price with- specific product discount."""-+ """Test that product discounts properly qualify checkout for price-based shipping."""# givencheckout_with_item.shipping_address = addressmanager = get_plugins_manager()diff --git a/saleor/graphql/core/tests/test_base_mutation.py b/saleor/graphql/core/tests/test_base_mutation.pyindex 18d414e257..c08d122e79 100644--- a/saleor/graphql/core/tests/test_base_mutation.py+++ b/saleor/graphql/core/tests/test_base_mutation.py@@ -50,7 +50,7 @@ class MutationWithCustomErrors(Mutation):class RestrictedMutation(Mutation):- """A mutation requiring the user to have given permissions"""+ """A mutation requiring the user to have certain permissions."""auth_token = graphene.types.String(description="The newly created authentication token."@@ -165,8 +165,6 @@ TEST_ORDER_MUTATION = """def test_order_mutation_resolve_uuid_id(order, schema_context, channel_USD):- """Ensure that order migrations can be perfromed with use of- new order id (uuid type)."""order_id = graphene.Node.to_global_id("Order", order.pk)variables = {"id": order_id, "channel": channel_USD.slug}result = schema.execute(@@ -177,8 +175,6 @@ def test_order_mutation_resolve_uuid_id(order, schema_context, channel_USD):def test_order_mutation_for_old_int_id(order, schema_context, channel_USD):- """Ensure that order migrations for orders with `use_old_id` flag set to True,- can be perfromed with use of old order id (int type)."""order.use_old_id = Trueorder.save(update_fields=["use_old_id"])@@ -248,9 +244,6 @@ def test_mutation_plugin_perform_mutation_handles_graphql_error(product,channel_USD,):- """Ensure when the mutation calls the method 'perform_mutation' on plugins,- the returned error "GraphQLError" is properly returned and transformed into a dict- """settings.PLUGINS = ["saleor.plugins.tests.sample_plugins.PluginSample",]@@ -287,9 +280,6 @@ def test_mutation_plugin_perform_mutation_handles_custom_execution_result(product,channel_USD,):- """Ensure when the mutation calls the method 'perform_mutation' on plugins,- if a "ExecutionResult" object is returned, then the GraphQL response contains it- """settings.PLUGINS = ["saleor.plugins.tests.sample_plugins.PluginSample",]@@ -334,10 +324,6 @@ def test_mutation_calls_plugin_perform_mutation_after_permission_checks(channel_USD,permission_manage_products,):- """- Ensure the mutation calls the method 'perform_mutation' on plugins only once the- user/app permissions are verified- """mutation_query = """mutation testRestrictedMutation($productId: ID!, $channel: String) {restrictedMutation(productId: $productId, channel: $channel) {diff --git a/saleor/graphql/core/tests/test_core_reordering.py b/saleor/graphql/core/tests/test_core_reordering.pyindex d385b0a76c..b5df88aeac 100644--- a/saleor/graphql/core/tests/test_core_reordering.py+++ b/saleor/graphql/core/tests/test_core_reordering.py@@ -50,10 +50,6 @@ def sorted_entries_gaps(dummy_attribute):def test_reordering_sequential(sorted_entries_seq):- """- Ensures the reordering logic works as expected. This test simply provides- sequential sort order values and try to reorder them.- """qs = SortedModel.objectsnodes = sorted_entries_seq@@ -77,10 +73,6 @@ def test_reordering_sequential(sorted_entries_seq):def test_reordering_non_sequential(sorted_entries_gaps):- """- Ensures that reordering non-sequential sort order values is properly- handled. This case happens when an item gets deleted, creating gaps between values.- """qs = SortedModel.objectsnodes = sorted_entries_gaps@@ -108,9 +100,7 @@ def test_reordering_non_sequential(sorted_entries_gaps):[((0, +5), (+5, -1, -1, -1, -1, -1)), ((5, -5), (+1, +1, +1, +1, +1, -5))],)def test_inserting_at_the_edges(sorted_entries_seq, operation, expected_operations):- """- Ensures it is possible to move an item at the top and bottom of the list.- """+ """Ensures it is possible to move an item at the top and bottom of the list."""qs = SortedModel.objectsnodes = sorted_entries_seq@@ -132,11 +122,6 @@ def test_inserting_at_the_edges(sorted_entries_seq, operation, expected_operatiodef test_reordering_out_of_bound(sorted_entries_seq):- """- Ensures it is not possible to manually create gaps or for the users- to insert anywhere they want, e.g. -1000, which could create a mess- into the database.- """qs = SortedModel.objectsnodes = sorted_entries_seq@@ -160,9 +145,7 @@ def test_reordering_out_of_bound(sorted_entries_seq):def test_reordering_null_sort_orders(dummy_attribute):- """- Ensures null sort orders values are getting properly ordered (by ID sorting).- """+ """Ensures null sort orders values are getting properly ordered (by ID sorting)."""attribute = dummy_attributeqs = SortedModel.objects@@ -202,10 +185,6 @@ def test_reordering_null_sort_orders(dummy_attribute):def test_reordering_nothing(sorted_entries_seq, assert_num_queries):- """- Ensures giving operations that does nothing, are skipped. Thus only one query should- have been made: fetching the nodes.- """qs = SortedModel.objectspk = sorted_entries_seq[0].pkoperations = {pk: 0}@@ -226,13 +205,7 @@ def test_giving_no_operation_does_no_query(sorted_entries_seq, assert_num_queriedef test_reordering_concurrently(dummy_attribute, assert_num_queries):- """- Ensures users cannot concurrently reorder, they need to wait for the other one- to achieve.-- This must be the first thing done before doing anything. For that, we ensure- the first SQL query is acquiring the lock.- """+ """Check that reordering properly locks the rows for update."""qs = SortedModel.objectsattribute = dummy_attribute@@ -270,12 +243,9 @@ def test_reordering_concurrently(dummy_attribute, assert_num_queries):)-def test_reordering_deleted_node_from_concurrent(dummy_attribute, assert_num_queries):- """- Ensures if a node was deleted before locking, it just skip it instead of- raising an error.- """-+def test_reordering_deleted_node_from_concurrent_update(+ dummy_attribute, assert_num_queries+):qs = SortedModel.objectsattribute = dummy_attributediff --git a/saleor/graphql/core/tests/test_file_upload.py b/saleor/graphql/core/tests/test_file_upload.pyindex 620d267b87..26614756f8 100644--- a/saleor/graphql/core/tests/test_file_upload.py+++ b/saleor/graphql/core/tests/test_file_upload.py@@ -121,9 +121,6 @@ def test_file_upload_by_superuser(superuser_api_client, media_root):def test_file_upload_file_with_the_same_name_already_exists(staff_api_client, media_root, site_settings):- """Ensure that when the file with the same name as uploaded file,- already exists, the file name will be renamed and save as another file.- """# givenimage_file1, image_name1 = create_image()path = default_storage.save(image_file1._name, image_file1)diff --git a/saleor/graphql/core/tests/test_graphql.py b/saleor/graphql/core/tests/test_graphql.pyindex c345c5ae34..1c7e7d9f32 100644--- a/saleor/graphql/core/tests/test_graphql.py+++ b/saleor/graphql/core/tests/test_graphql.py@@ -17,8 +17,7 @@ from ...utils import get_nodesdef test_middleware_dont_generate_sql_requests(client, settings, assert_num_queries):- """When requesting on the GraphQL API endpoint, no SQL request should happen- indirectly. This test ensures that."""+ """Test that a GET request results in no database queries."""# Enables the Graphql playgroundsettings.DEBUG = True@@ -272,8 +271,6 @@ def test_get_nodes(product_list):def test_get_nodes_for_order_with_int_id(order_list):- """Ensure that `get_nodes` returns correct nodes, when old id is used- for orders with the `use_old_id` flag set to True."""order_models.Order.objects.update(use_old_id=True)# given@@ -290,8 +287,6 @@ def test_get_nodes_for_order_with_int_id(order_list):def test_get_nodes_for_order_with_uuid_id(order_list):- """Ensure that `get_nodes` returns correct nodes, when the new uuid order id- is used."""# givenglobal_ids = [to_global_id("Order", order.pk) for order in order_list]@@ -306,8 +301,7 @@ def test_get_nodes_for_order_with_uuid_id(order_list):def test_get_nodes_for_order_with_int_id_and_use_old_id_set_to_false(order_list):- """Ensure that `get_nodes` does not return nodes, when old id is used- for orders with `use_old_id` flag set to False."""+ """Test that `get_node` respects `use_old_id`."""# givenglobal_ids = [to_global_id("Order", order.number) for order in order_list]@@ -320,8 +314,7 @@ def test_get_nodes_for_order_with_int_id_and_use_old_id_set_to_false(order_list)def test_get_nodes_for_order_with_uuid_and_int_id(order_list):- """Ensure that `get_nodes` returns correct nodes,- when old and new order id is provided."""+ """Test that `get_nodes` works for both old and new order IDs."""# givenorder_models.Order.objects.update(use_old_id=True)global_ids = [to_global_id("Order", order.pk) for order in order_list[:-1]]diff --git a/saleor/graphql/core/tests/test_pagination.py b/saleor/graphql/core/tests/test_pagination.pyindex 9689d8bff9..5b3dedb69a 100644--- a/saleor/graphql/core/tests/test_pagination.py+++ b/saleor/graphql/core/tests/test_pagination.py@@ -242,7 +242,6 @@ def test_pagination_invalid_cursor(books):def test_pagination_invalid_cursor_and_valid_base64(books):- """This cursor should have int value, in this test we pass string value."""cursor = base64.b64encode(str.encode(f"{['Test']}")).decode("utf-8")variables = {"first": 5, "after": cursor}diff --git a/saleor/graphql/discount/tests/mutations/test_sale_create.py b/saleor/graphql/discount/tests/mutations/test_sale_create.pyindex cab61967d3..0b37554043 100644--- a/saleor/graphql/discount/tests/mutations/test_sale_create.py+++ b/saleor/graphql/discount/tests/mutations/test_sale_create.py@@ -204,8 +204,6 @@ def test_create_sale_start_date_and_end_date_before_current_date(permission_manage_discounts,product_list,):- """Ensure the notification is sent when the sale is created with start- and end date that already passed."""# givenquery = SALE_CREATE_MUTATIONstart_date = timezone.now() - timedelta(days=20)@@ -261,8 +259,6 @@ def test_create_sale_start_date_and_end_date_after_current_date(permission_manage_discounts,product_list,):- """Ensure the notification is not sent when the sale is created with start- and end date in the feature."""# givenquery = SALE_CREATE_MUTATIONstart_date = timezone.now() + timedelta(days=10)diff --git a/saleor/graphql/discount/tests/mutations/test_sale_update.py b/saleor/graphql/discount/tests/mutations/test_sale_update.pyindex e1fa161f0b..cf061e0837 100644--- a/saleor/graphql/discount/tests/mutations/test_sale_update.py+++ b/saleor/graphql/discount/tests/mutations/test_sale_update.py@@ -156,9 +156,6 @@ def test_update_sale_start_date_after_current_date_notification_not_sent(catalogue_predicate,permission_manage_discounts,):- """Ensure the notification is not sent when the start date is set after the current- date.- """# givenquery = SALE_UPDATE_MUTATION@@ -214,9 +211,6 @@ def test_update_sale_start_date_before_current_date_notification_already_sent(catalogue_predicate,permission_manage_discounts,):- """Ensure the notification is not sent when the start date is set before- current date and notification was already sent.- """# givenquery = SALE_UPDATE_MUTATION@@ -276,10 +270,6 @@ def test_update_sale_start_date_before_current_date_notification_sent(catalogue_predicate,permission_manage_discounts,):- """Ensure the sale_toggle notification is sent and the notification date is set- when the start date is set before current date and the notification hasn't been sent- before.- """# givenquery = SALE_UPDATE_MUTATION@@ -336,9 +326,6 @@ def test_update_sale_end_date_after_current_date_notification_not_sent(catalogue_predicate,permission_manage_discounts,):- """Ensure the notification is not sent when the end date is set after- the current date.- """# givenquery = SALE_UPDATE_MUTATION@@ -395,10 +382,6 @@ def test_update_sale_end_date_before_current_date_notification_already_sent(catalogue_predicate,permission_manage_discounts,):- """Ensure the notification is sent when the end date is set before- current date, the notification was already sent but the end date was not set before.- It means we need to notify about ending the sale.- """# givenquery = SALE_UPDATE_MUTATIONnow = timezone.now()@@ -457,10 +440,6 @@ def test_update_sale_end_date_before_current_date_notification_sent(catalogue_predicate,permission_manage_discounts,):- """Ensure the sale_toggle notification is sent and the notification date is set- when the end date is set before current date and the notification hasn't been sent- before.- """# givenquery = SALE_UPDATE_MUTATIONdiff --git a/saleor/graphql/menu/tests/mutations/test_menu_item_move.py b/saleor/graphql/menu/tests/mutations/test_menu_item_move.pyindex e9712438d6..18b55cd0d5 100644--- a/saleor/graphql/menu/tests/mutations/test_menu_item_move.py+++ b/saleor/graphql/menu/tests/mutations/test_menu_item_move.py@@ -219,9 +219,7 @@ def test_menu_reorder_move_without_effect(def test_menu_reorder_assign_parent(staff_api_client, permission_manage_menus, menu_item_list):- """Assign a menu item as parent of given menu items. Ensure the menu items- are properly pushed at the bottom of the item's children.- """+ """Test that assigning parents results in the correct item order."""# givenmenu_item_list = list(menu_item_list)assert len(menu_item_list) == 3@@ -295,10 +293,7 @@ def test_menu_reorder_assign_parent(def test_menu_reorder_assign_and_unassign_parent(staff_api_client, permission_manage_menus, menu_item_list):- """Assign a menu item as parent of given menu items. Ensure the menu items- are properly pushed at the bottom of the item's children.- """-+ """Test that assigning and removing parents results in the correct item order."""# givenmenu_item_list = list(menu_item_list)assert len(menu_item_list) == 3@@ -374,10 +369,7 @@ def test_menu_reorder_assign_and_unassign_parent(def test_menu_reorder_unassign_and_assign_parent(staff_api_client, permission_manage_menus, menu_item_list):- """Assign a menu item as parent of given menu items. Ensure the menu items- are properly pushed at the bottom of the item's children.- """-+ """Test that removing and assigning parents results in the correct item order."""# givenmenu_item_list = list(menu_item_list)assert len(menu_item_list) == 3@@ -579,9 +571,6 @@ def test_menu_reorder_cannot_assign_to_itself(def test_menu_cannot_get_menu_item_not_from_same_menu(staff_api_client, permission_manage_menus, menu_item):- """You shouldn't be able to edit menu items that are not from the menu- you are actually editing"""-menu_without_items = Menu.objects.create(name="this menu has no items", slug="menu-no-items")@@ -612,9 +601,6 @@ def test_menu_cannot_get_menu_item_not_from_same_menu(def test_menu_cannot_pass_an_invalid_menu_item_node_type(staff_api_client, staff_user, permission_manage_menus, menu_item):- """You shouldn't be able to pass a menu item node- that is not an actual MenuType."""-# givenmenu_without_items = Menu.objects.create(name="this menu has no items", slug="menu-without-items"diff --git a/saleor/graphql/order/tests/integration/test_bulk_order.py b/saleor/graphql/order/tests/integration/test_bulk_order.pyindex e926f270e2..bf9d0bf0c5 100644--- a/saleor/graphql/order/tests/integration/test_bulk_order.py+++ b/saleor/graphql/order/tests/integration/test_bulk_order.py@@ -18,8 +18,10 @@ from ....tests.utils import get_graphql_contentfrom ...enums import StockUpdatePolicyEnumfrom ..mutations.test_draft_order_complete import DRAFT_ORDER_COMPLETE_MUTATIONfrom ..mutations.test_fulfillment_return_products import ORDER_FULFILL_RETURN_MUTATION-from ..mutations.test_order_bulk_create import order_bulk_input # noqa F401-from ..mutations.test_order_bulk_create import ORDER_BULK_CREATE+from ..mutations.test_order_bulk_create import (+ ORDER_BULK_CREATE,+ order_bulk_input, # noqa F401+)from ..mutations.test_order_fulfill import ORDER_FULFILL_MUTATIONdiff --git a/saleor/graphql/order/tests/integration/test_draft_order.py b/saleor/graphql/order/tests/integration/test_draft_order.pyindex 1dc5c3028a..cea9a9003a 100644--- a/saleor/graphql/order/tests/integration/test_draft_order.py+++ b/saleor/graphql/order/tests/integration/test_draft_order.py@@ -24,8 +24,6 @@ def test_create_order_by_staff_in_accessible_channel(shipping_method,graphql_address_data,):- """Ensure that staff user is able to create and complete the draft order- in the channel he has access to."""# givenpermission_group_manage_orders.restricted_access_to_channels = Truepermission_group_manage_orders.save(update_fields=["restricted_access_to_channels"])@@ -88,7 +86,7 @@ def test_create_order_by_staff_in_accessible_channel(@pytest.mark.integration-def test_user_cannot_manage_draft_order_after_loosing_the_channel_access(+def test_user_cannot_manage_draft_order_after_losing_access_to_channel(staff_api_client,permission_group_manage_orders,channel_USD,@@ -97,8 +95,6 @@ def test_user_cannot_manage_draft_order_after_loosing_the_channel_access(shipping_method,superuser_api_client,):- """Ensure that staff user cannot mark order as paid after loosing the access- to order channel."""# givenpermission_group_manage_orders.restricted_access_to_channels = Truepermission_group_manage_orders.save(update_fields=["restricted_access_to_channels"])diff --git a/saleor/graphql/order/tests/integration/test_order.py b/saleor/graphql/order/tests/integration/test_order.pyindex fb12513055..38bff19d5f 100644--- a/saleor/graphql/order/tests/integration/test_order.py+++ b/saleor/graphql/order/tests/integration/test_order.py@@ -10,7 +10,7 @@ from ..mutations.test_order_fulfill import ORDER_FULFILL_MUTATION@pytest.mark.integration-def test_user_cannot_manage_order_after_loosing_the_channel_access(+def test_user_cannot_manage_order_after_losing_access_to_channel(staff_api_client,superuser_api_client,permission_group_manage_orders,@@ -19,8 +19,6 @@ def test_user_cannot_manage_order_after_loosing_the_channel_access(warehouse,channel_PLN,):- """Ensure that staff user cannot cancel fulfillment after loosing the access- to order channel."""# givenpermission_group_manage_orders.user_set.add(staff_api_client.user)permission_group_all_perms_all_channels.user_set.add(superuser_api_client.user)diff --git a/saleor/graphql/order/tests/mutations/test_fulfillment_approve.py b/saleor/graphql/order/tests/mutations/test_fulfillment_approve.pyindex 90fca363a6..b895f2180b 100644--- a/saleor/graphql/order/tests/mutations/test_fulfillment_approve.py+++ b/saleor/graphql/order/tests/mutations/test_fulfillment_approve.py@@ -477,8 +477,6 @@ def test_fulfillment_approve_order_unpaid(def test_fulfillment_approve_preorder(staff_api_client, fulfillment, permission_group_manage_orders, site_settings):- """Fulfillment with WAITING_FOR_APPROVAL status can not be fulfilled- if it contains variant in preorder."""permission_group_manage_orders.user_set.add(staff_api_client.user)site_settings.fulfillment_auto_approve = Falsesite_settings.save(update_fields=["fulfillment_auto_approve"])diff --git a/saleor/graphql/order/tests/mutations/test_order_fulfill.py b/saleor/graphql/order/tests/mutations/test_order_fulfill.pyindex 753fba9783..6b261b9b92 100644--- a/saleor/graphql/order/tests/mutations/test_order_fulfill.py+++ b/saleor/graphql/order/tests/mutations/test_order_fulfill.py@@ -1405,8 +1405,6 @@ def test_order_fulfill_preorder_waiting_fulfillment(warehouse,site_settings,):- """If fulfillment_auto_approve is set to False,- it's possible to fulfill lines to WAITING_FOR_APPROVAL status."""permission_group_manage_orders.user_set.add(staff_api_client.user)site_settings.fulfillment_auto_approve = Falsesite_settings.save(update_fields=["fulfillment_auto_approve"])diff --git a/saleor/graphql/order/tests/mutations/test_order_note_add.py b/saleor/graphql/order/tests/mutations/test_order_note_add.pyindex fa13c7d34e..826538164e 100644--- a/saleor/graphql/order/tests/mutations/test_order_note_add.py+++ b/saleor/graphql/order/tests/mutations/test_order_note_add.py@@ -42,8 +42,6 @@ def test_order_note_add_as_staff_user(order_with_lines,staff_user,):- """We are testing that adding a note to an order as a staff user is doing the- expected behaviors."""# givenpermission_group_manage_orders.user_set.add(staff_api_client.user)order = order_with_linesdiff --git a/saleor/graphql/order/tests/queries/test_order.py b/saleor/graphql/order/tests/queries/test_order.pyindex 0349f4828f..06f7d9d96b 100644--- a/saleor/graphql/order/tests/queries/test_order.py+++ b/saleor/graphql/order/tests/queries/test_order.py@@ -423,8 +423,6 @@ def test_order_query_total_price_is_0(fulfilled_order,shipping_zone,):- """Ensure the payment status is FULLY_CHARGED when the order total is 0- and there is no payment."""# givenorder = fulfilled_orderprice = zero_taxed_money(order.currency)@@ -1198,8 +1196,6 @@ QUERY_ORDER_FIELDS_BY_ID = """def test_query_order_fields_order_with_new_id_by_staff_no_perm(order, staff_api_client):- """Ensure that all fields that are available for order owner can be fetched with- use of new id by staff user without permissions."""# givenvariables = {"id": graphene.Node.to_global_id("Order", order.pk)}@@ -1221,8 +1217,6 @@ def test_query_order_fields_order_with_new_id_by_staff_no_perm(order, staff_api_def test_query_order_fields_order_with_new_id_by_anonymous_user(order, api_client):- """Ensure that all fields that are available for order owner can be fetched with- use of new id by the customer user."""# givenvariables = {"id": graphene.Node.to_global_id("Order", order.pk)}@@ -1244,8 +1238,7 @@ def test_query_order_fields_order_with_new_id_by_anonymous_user(order, api_cliendef test_query_order_fields_by_old_id_staff_no_perms(order, staff_api_client):- """Ensure that all fields that are available for order owner cannot be fetched with- use of old id by staff user without permissions."""+ """Test that old order IDs require proper user permissions to access sensitive fields."""# givenorder.use_old_id = Trueorder.save(update_fields=["use_old_id"])@@ -1260,8 +1253,6 @@ def test_query_order_fields_by_old_id_staff_no_perms(order, staff_api_client):def test_query_order_fields_by_old_id_by_order_owner(order, user_api_client):- """Ensure that all fields that are available for order owner can be fetched with- use of old id by order owner."""# givenorder.use_old_id = Trueorder.save(update_fields=["use_old_id"])@@ -1288,8 +1279,6 @@ def test_query_order_fields_by_old_id_by_order_owner(order, user_api_client):def test_query_order_fields_by_old_id_staff_with_perm(order, staff_api_client, permission_manage_orders):- """Ensure that all fields that are available for order owner can be fetched with- use of old id by staff user with manage orders permission."""# givenorder.use_old_id = Trueorder.save(update_fields=["use_old_id"])@@ -1318,8 +1307,6 @@ def test_query_order_fields_by_old_id_staff_with_perm(def test_query_order_fields_by_old_id_app_with_perm(order, app_api_client, permission_manage_orders):- """Ensure that all fields that are available for order owner can be fetched with- use of old id by app with manage orders permission."""# givenorder.use_old_id = Trueorder.save(update_fields=["use_old_id"])@@ -1348,8 +1335,6 @@ def test_query_order_fields_by_old_id_app_with_perm(def test_query_order_fields_order_with_old_id_staff_with_perm(order, app_api_client, permission_manage_orders):- """Ensure that all fields that are available for order owner can be fetched with- use of old id by app with manage orders permission."""# givenorder.use_old_id = Trueorder.save(update_fields=["use_old_id"])@@ -1376,8 +1361,7 @@ def test_query_order_fields_order_with_old_id_staff_with_perm(def test_query_order_fields_by_old_id_app_no_perm(order, app_api_client):- """Ensure that all fields that are available for order owner cannot be fetched with- use of old id by app without permissions."""+ """Test that old order IDs require proper app permissions to access sensitive fields."""# givenorder.use_old_id = Trueorder.save(update_fields=["use_old_id"])diff --git a/saleor/graphql/page/tests/deprecated/test_page_create.py b/saleor/graphql/page/tests/deprecated/test_page_create.pyindex 36fab64e3b..c2998152bb 100644--- a/saleor/graphql/page/tests/deprecated/test_page_create.py+++ b/saleor/graphql/page/tests/deprecated/test_page_create.py@@ -111,8 +111,7 @@ def test_page_create_mutation_with_publication_date(def test_page_create_mutation_publication_date_and_published_at_provided(staff_api_client, permission_manage_pages, page_type):- """Ensure an error is raised when publishedAt and publicationDate are both- provided."""+ """Test that setting publication date and time are mutually exclusive."""page_slug = "test-slug"page_content = dummy_editorjs("test content", True)page_title = "test title"diff --git a/saleor/graphql/page/tests/deprecated/test_page_update.py b/saleor/graphql/page/tests/deprecated/test_page_update.pyindex 3d4e1a624a..39cbb00aa4 100644--- a/saleor/graphql/page/tests/deprecated/test_page_update.py+++ b/saleor/graphql/page/tests/deprecated/test_page_update.py@@ -78,8 +78,7 @@ def test_update_page_publication_date(def test_page_update_mutation_publication_date_and_published_at_provided(staff_api_client, permission_manage_pages, page_type):- """Ensure an error is raised when publishedAt and publicationDate are both- provided."""+ """Test that setting publication date and time are mutually exclusive."""data = {"slug": "test-url","title": "Test page",diff --git a/saleor/graphql/page/tests/queries/test_pages.py b/saleor/graphql/page/tests/queries/test_pages.pyindex 2c4fef03d1..3d5a35111f 100644--- a/saleor/graphql/page/tests/queries/test_pages.py+++ b/saleor/graphql/page/tests/queries/test_pages.py@@ -223,8 +223,6 @@ PAGES_QUERY = """def test_query_pages_by_staff(staff_api_client, page_list, page, permission_manage_pages):- """Ensure staff user with manage pages permission can query all pages,- including unpublished pages."""# givenunpublished_page = pageunpublished_page.is_published = False@@ -244,8 +242,6 @@ def test_query_pages_by_staff(def test_query_pages_by_app(app_api_client, page_list, page, permission_manage_pages):- """Ensure app with manage pages permission can query all pages,- including unpublished pages."""# givenunpublished_page = pageunpublished_page.is_published = False@@ -265,9 +261,6 @@ def test_query_pages_by_app(app_api_client, page_list, page, permission_manage_pdef test_query_pages_by_staff_no_perm(staff_api_client, page_list, page):- """Ensure staff user without manage pages permission can query- only published pages."""-# givenunpublished_page = pageunpublished_page.is_published = Falsediff --git a/saleor/graphql/payment/tests/mutations/test_payment_capture.py b/saleor/graphql/payment/tests/mutations/test_payment_capture.pyindex 9a8c71c226..7de2af06ba 100644--- a/saleor/graphql/payment/tests/mutations/test_payment_capture.py+++ b/saleor/graphql/payment/tests/mutations/test_payment_capture.py@@ -125,12 +125,9 @@ def test_payment_capture_with_invalid_argument(assert data["errors"][0]["message"] == "Amount should be a positive number."-def test_payment_capture_with_payment_non_authorized_yet(+def test_payment_capture_with_unauthorized_payment(staff_api_client, permission_group_manage_orders, payment_dummy):- """Ensure capture a payment that is set as authorized is failing with- the proper error message.- """# givenpermission_group_manage_orders.user_set.add(staff_api_client.user)payment = payment_dummydiff --git a/saleor/graphql/plugins/tests/queries/test_plugin.py b/saleor/graphql/plugins/tests/queries/test_plugin.pyindex 89a3ee12b7..f5767d4f08 100644--- a/saleor/graphql/plugins/tests/queries/test_plugin.py+++ b/saleor/graphql/plugins/tests/queries/test_plugin.py@@ -251,7 +251,6 @@ def test_query_plugin_configuration_as_customer_user(user_api_client, settings):def test_cannot_retrieve_hidden_plugin(settings, staff_api_client_can_manage_plugins):- """Ensure one cannot retrieve the details of a hidden global plugin"""client = staff_api_client_can_manage_pluginssettings.PLUGINS = ["saleor.plugins.tests.sample_plugins.PluginSample"]variables = {"id": PluginSample.PLUGIN_ID}@@ -270,10 +269,9 @@ def test_cannot_retrieve_hidden_plugin(settings, staff_api_client_can_manage_pluassert content["data"] == {"plugin": None}, "shouldn't have found plugin"-def test_cannot_retrieve_hidden_multi_channel_plugin(+def test_cannot_retrieve_hidden_multichannel_plugin(settings, staff_api_client_can_manage_plugins, channel_PLN):- """Ensure one cannot retrieve the details of a hidden multi channel plugin"""client = staff_api_client_can_manage_pluginssettings.PLUGINS = ["saleor.plugins.tests.sample_plugins.ChannelPluginSample"]variables = {"id": ChannelPluginSample.PLUGIN_ID}diff --git a/saleor/graphql/plugins/tests/queries/test_plugins.py b/saleor/graphql/plugins/tests/queries/test_plugins.pyindex 9aaa26090e..472c0673df 100644--- a/saleor/graphql/plugins/tests/queries/test_plugins.py+++ b/saleor/graphql/plugins/tests/queries/test_plugins.py@@ -375,7 +375,6 @@ def test_query_plugins_with_sort(def test_cannot_retrieve_hidden_plugins(settings, staff_api_client_can_manage_plugins, channel_PLN):- """Ensure one cannot see hidden plugins when listing"""settings.PLUGINS = ["saleor.plugins.tests.sample_plugins.ChannelPluginSample","saleor.plugins.tests.sample_plugins.PluginSample",diff --git a/saleor/graphql/plugins/tests/test_mutation_plugin_update.py b/saleor/graphql/plugins/tests/test_mutation_plugin_update.pyindex eb4d96026a..427be29917 100644--- a/saleor/graphql/plugins/tests/test_mutation_plugin_update.py+++ b/saleor/graphql/plugins/tests/test_mutation_plugin_update.py@@ -319,10 +319,9 @@ def test_plugin_configuration_update_as_customer_user(user_api_client, settings)assert_no_permission(response)-def test_cannot_update_configuration_hidden_plugin(+def test_cannot_update_configuration_of_hidden_plugin(settings, staff_api_client_can_manage_plugins):- """Ensure one cannot edit the configuration of hidden plugins"""client = staff_api_client_can_manage_pluginssettings.PLUGINS = ["saleor.plugins.tests.sample_plugins.PluginSample"]@@ -360,12 +359,11 @@ def test_cannot_update_configuration_hidden_plugin(assert plugin.configuration != original_config-def test_cannot_update_configuration_hidden_multi_channel_plugin(+def test_cannot_update_configuration_of_hidden_multichannel_plugin(settings,staff_api_client_can_manage_plugins,channel_USD,):- """Ensure one cannot edit the configuration of hidden multi channel plugins"""client = staff_api_client_can_manage_pluginssettings.PLUGINS = ["saleor.plugins.tests.sample_plugins.ChannelPluginSample"]diff --git a/saleor/graphql/product/mutations/channels.py b/saleor/graphql/product/mutations/channels.pyindex e5b62499f3..b445e8a3e9 100644--- a/saleor/graphql/product/mutations/channels.py+++ b/saleor/graphql/product/mutations/channels.py@@ -12,11 +12,13 @@ from ....core.tracing import traced_atomic_transactionfrom ....core.utils.date_time import convert_to_utc_date_timefrom ....permission.enums import ProductPermissionsfrom ....product.error_codes import CollectionErrorCode, ProductErrorCode-from ....product.models import CollectionChannelListing+from ....product.models import (+ CollectionChannelListing,+ ProductChannelListing,+ ProductVariantChannelListing,+)from ....product.models import Product as ProductModel-from ....product.models import ProductChannelListingfrom ....product.models import ProductVariant as ProductVariantModel-from ....product.models import ProductVariantChannelListingfrom ....product.tasks import update_products_discounted_prices_for_promotion_taskfrom ...channel import ChannelContextfrom ...channel.mutations import BaseChannelListingMutationdiff --git a/saleor/graphql/product/tests/deprecated/test_collection_channel_listing_update.py b/saleor/graphql/product/tests/deprecated/test_collection_channel_listing_update.pyindex 70f64c2da7..cd6e806c95 100644--- a/saleor/graphql/product/tests/deprecated/test_collection_channel_listing_update.py+++ b/saleor/graphql/product/tests/deprecated/test_collection_channel_listing_update.py@@ -238,8 +238,7 @@ def test_collection_channel_listing_update_update_publication_date(def test_collection_channel_listing_update_update_publication_date_and_published_at(staff_api_client, collection, permission_manage_products, channel_USD):- """Ensure an error is raised when both publicationDate and publishedAt date- is given."""+ """Test that filtering by publication time and date are mutually exclusive."""# givenpublication_date = datetime.date.today()published_at = datetime.datetime.now(pytz.utc)diff --git a/saleor/graphql/product/tests/deprecated/test_product_channel_listing_update.py b/saleor/graphql/product/tests/deprecated/test_product_channel_listing_update.pyindex 9a6b14c844..fb5fd9cdc6 100644--- a/saleor/graphql/product/tests/deprecated/test_product_channel_listing_update.py+++ b/saleor/graphql/product/tests/deprecated/test_product_channel_listing_update.py@@ -288,8 +288,7 @@ def test_product_channel_listing_update_update_publication_data(def test_product_channel_listing_update_update_publication_date_and_published_at(staff_api_client, product, permission_manage_products, channel_USD):- """Ensure an error is raised when both publicationDate and publishedAt date- is given."""+ """Test that filtering by publication time and date are mutually exclusive."""# givenpublication_date = datetime.date.today()published_at = datetime.datetime.now(pytz.utc)@@ -454,8 +453,7 @@ def test_product_channel_listing_update_update_is_available_for_purchase_false_adef test_product_channel_listing_update_available_for_purchase_both_date_value_given(staff_api_client, product, permission_manage_products, channel_USD):- """Ensure an error is raised when both availableForPurchaseDate and- availableForPurchaseAt date is given."""+ """Test that filtering by availability time and date are mutually exclusive."""# givenavailable_for_purchase_date = datetime.date.today()available_for_purchase_at = datetime.datetime.now(pytz.utc)diff --git a/saleor/graphql/product/tests/deprecated/test_product_sorting.py b/saleor/graphql/product/tests/deprecated/test_product_sorting.pyindex d57fe6ac54..37475f7899 100644--- a/saleor/graphql/product/tests/deprecated/test_product_sorting.py+++ b/saleor/graphql/product/tests/deprecated/test_product_sorting.py@@ -128,8 +128,6 @@ QUERY_PAGINATED_SORTED_PRODUCTS = """def test_pagination_for_sorting_products_by_publication_date(api_client, channel_USD, product_list):- """Ensure that using the cursor in sorting products by publication date works- properly."""# givenchannel_listings = ProductChannelListing.objects.filter(channel_id=channel_USD.id)listings_in_bulk = {listing.product_id: listing for listing in channel_listings}@@ -197,8 +195,6 @@ QUERY_PAGINATED_SORTED_COLLECTIONS = """def test_pagination_for_sorting_collections_by_publication_date(api_client, channel_USD):- """Ensure that using the cursor in sorting collections by publication date works- properly."""# givencollections = Collection.objects.bulk_create([diff --git a/saleor/graphql/product/tests/deprecated/test_product_variant_bulk_create.py b/saleor/graphql/product/tests/deprecated/test_product_variant_bulk_create.pyindex b2ba3db7e6..591d320457 100644--- a/saleor/graphql/product/tests/deprecated/test_product_variant_bulk_create.py+++ b/saleor/graphql/product/tests/deprecated/test_product_variant_bulk_create.py@@ -227,9 +227,7 @@ def test_product_variant_bulk_create_with_swatch_attribute(def test_product_variant_bulk_create_only_not_variant_selection_attributes(staff_api_client, product, size_attribute, permission_manage_products):- """Ensure that sku is set as variant name when only variant selection attributes- are assigned.- """+ """Test that the variant name defaults to SKU if no selection attributes exist."""product_variant_count = ProductVariant.objects.count()attribute_value_count = size_attribute.values.count()diff --git a/saleor/graphql/product/tests/mutations/test_product_create.py b/saleor/graphql/product/tests/mutations/test_product_create.pyindex f01edbc852..e014f5c4ca 100644--- a/saleor/graphql/product/tests/mutations/test_product_create.py+++ b/saleor/graphql/product/tests/mutations/test_product_create.py@@ -584,8 +584,6 @@ def test_create_product_no_value_for_rich_text_attribute(rich_text_attribute,permission_manage_products,):- """Ensure mutation not fail when as attributes input only rich text attribute id- is provided."""query = CREATE_PRODUCT_MUTATIONproduct_type_id = graphene.Node.to_global_id("ProductType", product_type.pk)@@ -710,8 +708,6 @@ def test_create_product_no_value_for_plain_text_attribute(permission_manage_products,):# given- """Ensure mutation not fail when as attributes input only plain text attribute id- is provided."""query = CREATE_PRODUCT_MUTATIONproduct_type_id = graphene.Node.to_global_id("ProductType", product_type.pk)@@ -886,8 +882,6 @@ def test_create_product_no_value_for_date_attribute(date_attribute,permission_manage_products,):- """Ensure mutation not fail when as attributes input only date attribute id- is provided."""query = CREATE_PRODUCT_MUTATIONproduct_type_id = graphene.Node.to_global_id("ProductType", product_type.pk)@@ -991,8 +985,6 @@ def test_create_product_no_value_for_boolean_attribute(boolean_attribute,permission_manage_products,):- """Ensure mutation not fail when as attributes input only boolean attribute id- is provided."""query = CREATE_PRODUCT_MUTATIONproduct_type_id = graphene.Node.to_global_id("ProductType", product_type.pk)diff --git a/saleor/graphql/product/tests/mutations/test_product_update.py b/saleor/graphql/product/tests/mutations/test_product_update.pyindex 4fb34756de..814396d90c 100644--- a/saleor/graphql/product/tests/mutations/test_product_update.py+++ b/saleor/graphql/product/tests/mutations/test_product_update.py@@ -1181,9 +1181,6 @@ def test_update_product_with_page_reference_attribute_value(def test_update_product_without_supplying_required_product_attribute(staff_api_client, product, permission_manage_products, color_attribute):- """Ensure assigning an existing value to a product doesn't create a new- attribute value."""-# givenstaff_api_client.user.user_permissions.add(permission_manage_products)@@ -1935,10 +1932,6 @@ SET_ATTRIBUTES_TO_PRODUCT_QUERY = """def test_update_product_can_only_assign_multiple_values_to_valid_input_types(staff_api_client, product, permission_manage_products, color_attribute):- """Ensures you cannot assign multiple values to input types- that are not multi-select. This also ensures multi-select types- can be assigned multiple values as intended."""-staff_api_client.user.user_permissions.add(permission_manage_products)multi_values_attr = Attribute.objects.create(@@ -1977,9 +1970,6 @@ def test_update_product_can_only_assign_multiple_values_to_valid_input_types(def test_update_product_with_existing_attribute_value(staff_api_client, product, permission_manage_products, color_attribute):- """Ensure assigning an existing value to a product doesn't create a new- attribute value."""-staff_api_client.user.user_permissions.add(permission_manage_products)expected_attribute_values_count = color_attribute.values.count()diff --git a/saleor/graphql/product/tests/mutations/test_product_variant_bulk_create.py b/saleor/graphql/product/tests/mutations/test_product_variant_bulk_create.pyindex 490dd45c69..c8fe750571 100644--- a/saleor/graphql/product/tests/mutations/test_product_variant_bulk_create.py+++ b/saleor/graphql/product/tests/mutations/test_product_variant_bulk_create.py@@ -861,10 +861,7 @@ def test_product_variant_bulk_create_with_multiselect_attribute(def test_product_variant_bulk_create_only_not_variant_selection_attributes(staff_api_client, product, size_attribute, permission_manage_products):- """Ensure that sku is set as variant name when only variant selection attributes- are assigned.- """-+ """Test that variant name defaults to SKU if no selection attributes exist."""# givenproduct_variant_count = ProductVariant.objects.count()attribute_value_count = size_attribute.values.count()diff --git a/saleor/graphql/product/tests/mutations/test_product_variant_delete.py b/saleor/graphql/product/tests/mutations/test_product_variant_delete.pyindex 6760076350..c6c81e4d28 100644--- a/saleor/graphql/product/tests/mutations/test_product_variant_delete.py+++ b/saleor/graphql/product/tests/mutations/test_product_variant_delete.py@@ -388,8 +388,7 @@ def test_delete_variant_delete_product_channel_listing_without_available_channelproduct,permission_manage_products,):- """Ensure that when the last available variant for channel is removed,- the corresponging product channel listings will be removed too."""+ """Test that the product is unlisted if all listed variants are removed."""# givenquery = DELETE_VARIANT_MUTATIONvariant = product.variants.first()@@ -430,8 +429,7 @@ def test_delete_variant_delete_product_channel_listing_not_deleted(product_with_two_variants,permission_manage_products,):- """Ensure that any other available variant for channel exist,- the corresponging product channel listings will be not removed."""+ """Test that the product listing persists if any variant listings remain."""# givenquery = DELETE_VARIANT_MUTATIONproduct = product_with_two_variantsdiff --git a/saleor/graphql/product/tests/mutations/test_product_variant_update.py b/saleor/graphql/product/tests/mutations/test_product_variant_update.pyindex 98f84eac8e..1326e47976 100644--- a/saleor/graphql/product/tests/mutations/test_product_variant_update.py+++ b/saleor/graphql/product/tests/mutations/test_product_variant_update.py@@ -2249,8 +2249,7 @@ def test_update_product_variant_can_not_turn_off_preorder(permission_manage_products,preorder_variant_global_threshold,):- """Passing None with `preorder` field can not turn off preorder,- it could be done only with ProductVariantPreorderDeactivate mutation."""+ """Test that preorder cannot be disabled through updating the `preorder` field directly."""variant = preorder_variant_global_thresholdvariant_id = graphene.Node.to_global_id("ProductVariant", variant.pk)sku = "test sku"diff --git a/saleor/graphql/product/tests/queries/test_product_query.py b/saleor/graphql/product/tests/queries/test_product_query.pyindex a7df40dfb5..0ba4c3761e 100644--- a/saleor/graphql/product/tests/queries/test_product_query.py+++ b/saleor/graphql/product/tests/queries/test_product_query.py@@ -1366,9 +1366,6 @@ def test_product_restricted_fields_permissions(product,channel_USD,):- """Ensure non-public (restricted) fields are correctly requiring- the 'manage_products' permission.- """query = """query Product($id: ID!, $channel: String) {product(id: $id, channel: $channel) {diff --git a/saleor/graphql/product/tests/queries/test_products_query_with_filter.py b/saleor/graphql/product/tests/queries/test_products_query_with_filter.pyindex cb901bd74f..62fcf761f7 100644--- a/saleor/graphql/product/tests/queries/test_products_query_with_filter.py+++ b/saleor/graphql/product/tests/queries/test_products_query_with_filter.py@@ -374,9 +374,6 @@ def test_products_query_with_filter_date_range_date_attributes(date_attribute,channel_USD,):- """Ensure both products will be returned when filtering attributes by date range,- products with the same date attribute value."""-# givenproduct_type = product_list[0].product_typedate_value = timezone.now()@@ -438,9 +435,6 @@ def test_products_query_with_filter_date_range_date_variant_attributes(date_attribute,channel_USD,):- """Ensure both products will be returned when filtering attributes by date range,- variants with the same date attribute value."""-# givenproduct_type = product_list[0].product_typedate_value = timezone.now()@@ -502,9 +496,6 @@ def test_products_query_with_filter_date_range_date_time_attributes(date_time_attribute,channel_USD,):- """Ensure both products will be returned when filtering attributes by date time- range, products with the same date time attribute value."""-# givenproduct_type = product_list[0].product_typedate_value = timezone.now()@@ -569,9 +560,6 @@ def test_products_query_with_filter_date_range_date_time_variant_attributes(date_time_attribute,channel_USD,):- """Ensure both products will be returned when filtering attributes by date time- range, variant and product with the same date time attribute value."""-# givenproduct_type = product_list[0].product_typedate_value = timezone.now()@@ -636,9 +624,6 @@ def test_products_query_with_filter_date_time_range_date_time_attributes(date_time_attribute,channel_USD,):- """Ensure both products will be returned when filtering by attributes by date range- variants with the same date attribute value."""-# givenproduct_type = product_list[0].product_typedate_value = datetime.now(tz=pytz.utc)diff --git a/saleor/graphql/product/tests/queries/test_products_query_with_where.py b/saleor/graphql/product/tests/queries/test_products_query_with_where.pyindex 8b7d022333..ef78d8c625 100644--- a/saleor/graphql/product/tests/queries/test_products_query_with_where.py+++ b/saleor/graphql/product/tests/queries/test_products_query_with_where.py@@ -956,9 +956,6 @@ def test_products_filter_by_date_range_date_attributes(date_attribute,channel_USD,):- """Ensure both products will be returned when filtering attributes by date range,- products with the same date attribute value."""-# givenproduct_type = product_list[0].product_typedate_value = timezone.now()@@ -1017,9 +1014,6 @@ def test_products_filter_by_date_range_date_variant_attributes(date_attribute,channel_USD,):- """Ensure both products will be returned when filtering attributes by date range,- variants with the same date attribute value."""-# givenproduct_type = product_list[0].product_typedate_value = timezone.now()@@ -1078,9 +1072,6 @@ def test_products_filter_by_date_range_date_time_attributes(date_time_attribute,channel_USD,):- """Ensure both products will be returned when filtering attributes by date time- range, products with the same date time attribute value."""-# givenproduct_type = product_list[0].product_typedate_value = timezone.now()@@ -1142,9 +1133,6 @@ def test_products_filter_by_date_range_date_time_variant_attributes(date_time_attribute,channel_USD,):- """Ensure both products will be returned when filtering attributes by date time- range, variant and product with the same date time attribute value."""-# givenproduct_type = product_list[0].product_typedate_value = timezone.now()@@ -1206,9 +1194,6 @@ def test_products_filter_by_date_time_range_date_time_attributes(date_time_attribute,channel_USD,):- """Ensure both products will be returned when filtering by attributes by date range- variants with the same date attribute value."""-# givenproduct_type = product_list[0].product_typedate_value = timezone.now()diff --git a/saleor/graphql/product/tests/queries/test_variant_query.py b/saleor/graphql/product/tests/queries/test_variant_query.pyindex 5ca84cc430..18ec150316 100644--- a/saleor/graphql/product/tests/queries/test_variant_query.py+++ b/saleor/graphql/product/tests/queries/test_variant_query.py@@ -626,9 +626,6 @@ def test_variant_restricted_fields_permissions(is_nested,channel_USD,):- """Ensure non-public (restricted) fields are correctly requiring- the 'manage_products' permission.- """query = """query ProductVariant($id: ID!, $channel: String) {productVariant(id: $id, channel: $channel) {diff --git a/saleor/graphql/product/tests/test_attributes.py b/saleor/graphql/product/tests/test_attributes.pyindex 2d4affbe0f..cd75e8ec1f 100644--- a/saleor/graphql/product/tests/test_attributes.py+++ b/saleor/graphql/product/tests/test_attributes.py@@ -62,9 +62,7 @@ def test_resolve_attributes_with_hidden(permission_manage_products,channel_USD,):- """Ensure non-staff users don't see hidden attributes, and staff users having- the 'manage product' permission can.- """+ """Test that only staff users can see hidden attributes."""variables = {"channel": channel_USD.slug}query = QUERY_PRODUCT_AND_VARIANTS_ATTRIBUTESapi_client = user_api_client@@ -144,10 +142,7 @@ def test_resolve_attribute_values(user_api_client, product, staff_user, channel_def test_resolve_attribute_values_non_assigned_to_node(user_api_client, product, staff_user, channel_USD):- """Ensure the attribute values are properly resolved when an attribute is part- of the product type but not of the node (product/variant), thus no values should be- resolved.- """+ """Test that excessive attributes are not listed even if present."""variables = {"channel": channel_USD.slug}query = QUERY_PRODUCT_AND_VARIANTS_ATTRIBUTESapi_client = user_api_client@@ -204,9 +199,7 @@ def test_resolve_attribute_values_non_assigned_to_node(def test_resolve_assigned_attribute_without_values(api_client, product_type, product, channel_USD):- """Ensure the attributes assigned to a product type are resolved even if- the product doesn't provide any value for it or is not directly associated to it.- """+ """Test that all attributes are listed even if values are missing."""# Retrieve the product's variantvariant = product.variants.get()@@ -389,10 +382,6 @@ def test_assign_variant_attribute_to_product_type_with_disabled_variants(product_type_without_variant,color_attribute_without_values,):- """The assignAttribute mutation should raise an error when trying- to add an attribute as a variant attribute when- the product type doesn't support variants"""-product_type = product_type_without_variantattribute = color_attribute_without_valuesstaff_api_client.user.user_permissions.add(@@ -457,10 +446,6 @@ def test_assign_variant_attribute_having_multiselect_input_type_with_variant_selproduct_type,size_attribute,):- """The assignAttribute mutation should raise an error when trying- to use an attribute as a variant attribute when- the attribute's input type doesn't support variants"""-attribute = size_attributeattribute.input_type = AttributeInputType.MULTISELECTattribute.save(update_fields=["input_type"])@@ -546,9 +531,6 @@ def test_assign_attribute_to_product_type_having_already_that_attribute(product_type_attribute_type,gql_attribute_type,):- """The assignAttribute mutation should raise an error when trying- to add an attribute already contained in the product type."""-product_type = ProductType.objects.create(name="Type", kind=ProductTypeKind.NORMAL)attribute = color_attribute_without_valuesstaff_api_client.user.user_permissions.add(@@ -613,14 +595,11 @@ PRODUCT_ASSIGN_ATTR_UPDATE_QUERY = """"""-def test_assignment_attribute_update_not_assigned_attribute_should_raise_an_errors(+def test_assignment_attribute_update_not_assigned_attribute_should_raise_an_error(staff_api_client,permission_manage_product_types_and_attributes,color_attribute_without_values,):- """The productAttributeAssignmentUpdate mutation should raise an error when trying- to modify unassigned variant attribute."""-product_type = ProductType.objects.create(name="Type", kind=ProductTypeKind.NORMAL)attribute = color_attribute_without_valuesstaff_api_client.user.user_permissions.add(@@ -667,9 +646,6 @@ def test_assignment_attribute_update_assigned_to_product_should_raise_an_error(permission_manage_product_types_and_attributes,color_attribute_without_values,):- """The productAttributeAssignmentUpdate mutation should raise an error when trying- to modify assigned to product attribute."""-product_type = ProductType.objects.create(name="Type", kind=ProductTypeKind.NORMAL)attribute = color_attribute_without_valuesstaff_api_client.user.user_permissions.add(@@ -711,9 +687,6 @@ def test_assignment_attrib_update_assigned_with_duplicates_type_should_raise_an_permission_manage_product_types_and_attributes,color_attribute_without_values,):- """The productAttributeAssignmentUpdate mutation should raise an error when- to modify operations with duplicated attribute ids."""-product_type = ProductType.objects.create(name="Type", kind=ProductTypeKind.NORMAL)attribute = color_attribute_without_values@@ -763,9 +736,6 @@ def test_assignment_attribute_update_assigned_unsupported_type_should_raise_an_epermission_manage_product_types_and_attributes,color_attribute_without_values,):- """The productAttributeAssignmentUpdate mutation should raise an error when trying- to modify unsupported variant attribute."""-product_type = ProductType.objects.create(name="Type", kind=ProductTypeKind.NORMAL)attribute = color_attribute_without_valuesattribute.input_type = AttributeInputType.MULTISELECT@@ -817,9 +787,6 @@ def test_assignment_attribute_update_assigned_should_modify_variant_selection(size_attribute,color_attribute_without_values,):- """The productAttributeAssignmentUpdate mutation should modify- variant selection when validation successful."""-product_type = ProductType.objects.create(name="Type", kind=ProductTypeKind.NORMAL)attribute_1 = color_attribute_without_valuesattribute_2 = size_attribute@@ -866,9 +833,6 @@ def test_assignment_attrib_update_assigned_should_modify_variant_selection_from_size_attribute,color_attribute_without_values,):- """The productAttributeAssignmentUpdate mutation should modify- variant selection from external app when validation successful."""-product_type = ProductType.objects.create(name="Type", kind=ProductTypeKind.NORMAL)attribute_1 = color_attribute_without_valuesattribute_2 = size_attribute@@ -1093,9 +1057,6 @@ def test_unassign_attributes_not_in_product_type(permission_manage_product_types_and_attributes,color_attribute_without_values,):- """The unAssignAttribute mutation should not raise any error when trying- to remove an attribute that is not/no longer in the product type."""-staff_api_client.user.user_permissions.add(permission_manage_product_types_and_attributes)diff --git a/saleor/graphql/product/tests/test_bulk_delete.py b/saleor/graphql/product/tests/test_bulk_delete.pyindex 50555d7d86..4d97a0c0f9 100644--- a/saleor/graphql/product/tests/test_bulk_delete.py+++ b/saleor/graphql/product/tests/test_bulk_delete.py@@ -1824,10 +1824,7 @@ def test_delete_variants_delete_product_channel_listing_without_available_channeproduct_with_two_variants,permission_manage_products,):- """Ensure that when the last available variant for channel is removed,- the corresponging product channel listings will be removed too, and when- any available variant for channel exist the product channel listing will- be not removed."""+ """Test that a channel listing is removed when the last listed variant is removed."""# givenquery = PRODUCT_VARIANT_BULK_DELETE_MUTATIONdiff --git a/saleor/graphql/product/tests/test_collection.py b/saleor/graphql/product/tests/test_collection.pyindex f20db30859..a79cdb548d 100644--- a/saleor/graphql/product/tests/test_collection.py+++ b/saleor/graphql/product/tests/test_collection.py@@ -1991,8 +1991,6 @@ QUERY_PAGINATED_SORTED_COLLECTIONS = """def test_pagination_for_sorting_collections_by_published_at_date(api_client, channel_USD):- """Ensure that using the cursor in sorting collections by published at date works- properly."""# givencollections = Collection.objects.bulk_create([diff --git a/saleor/graphql/product/tests/test_product_sorting.py b/saleor/graphql/product/tests/test_product_sorting.pyindex fb789e6fd3..4b89364ae6 100644--- a/saleor/graphql/product/tests/test_product_sorting.py+++ b/saleor/graphql/product/tests/test_product_sorting.py@@ -277,8 +277,6 @@ QUERY_PAGINATED_SORTED_PRODUCTS = """def test_pagination_for_sorting_products_by_published_at_date(api_client, channel_USD, product_list):- """Ensure that using the cursor in sorting products by published at date works- properly."""# givenchannel_listings = ProductChannelListing.objects.filter(channel_id=channel_USD.id)listings_in_bulk = {listing.product_id: listing for listing in channel_listings}diff --git a/saleor/graphql/product/tests/test_product_sorting_attributes.py b/saleor/graphql/product/tests/test_product_sorting_attributes.pyindex 011d34bfca..7ca2c20207 100644--- a/saleor/graphql/product/tests/test_product_sorting_attributes.py+++ b/saleor/graphql/product/tests/test_product_sorting_attributes.py@@ -227,9 +227,7 @@ def products_structures(category, channel_USD):def test_sort_products_cannot_sort_both_by_field_and_by_attribute(api_client, channel_USD):- """Ensure one cannot both sort by a supplied field and sort by a given attribute ID- at the same time.- """+ """Test that sorting by field and by attribute are mutually exclusive."""query = QUERY_SORT_PRODUCTS_BY_ATTRIBUTEvariables = {"field": "NAME",@@ -549,9 +547,10 @@ def test_sort_product_by_attribute_multiple_values(def test_sort_product_not_having_attribute_data(api_client, category, count_queries):- """Test the case where a product has a given attribute assigned to their- product type but no attribute data assigned, i.e. the product's PT was changed- after the product creation.+ """Test sorting when an attribute exists but does not have a value.++ For example, when the product's product type was updated after the product+ was created."""expected_results = ["Z", "Y", "A"]product_create_kwargs = {"category": category}diff --git a/saleor/graphql/product/tests/test_variant_availability.py b/saleor/graphql/product/tests/test_variant_availability.pyindex 0d2d34c002..7a55124a62 100644--- a/saleor/graphql/product/tests/test_variant_availability.py+++ b/saleor/graphql/product/tests/test_variant_availability.py@@ -180,8 +180,10 @@ def test_variant_quantity_available_without_country_code_and_no_channel_shippingdef test_variant_quantity_available_no_country_warehouse_without_zone(api_client, variant_with_many_stocks, channel_USD, channel_PLN):- """Ensure the warehouse without shipping zones is not counted in variant available- quantity."""+ """Test that available quantity only includes warehouses that belong to a shipping zone.++ In this case, a channel is provided, but no country code.+ """# givenassert variant_with_many_stocks.stocks.count() == 2@@ -212,8 +214,10 @@ def test_variant_quantity_available_no_channel_and_no_country_warehouse_without_permission_manage_discounts,permission_manage_orders,):- """Ensure the warehouse without shipping zones is not counted in variant available- quantity."""+ """Test that available quantity only includes warehouses that belong to a shipping zone.++ In this case, neither a channel nor country code is provided.+ """# givenassert variant_with_many_stocks.stocks.count() == 2@@ -250,9 +254,7 @@ def test_variant_quantity_available_only_warehouse_without_zone_no_channel_no_copermission_manage_discounts,permission_manage_orders,):- """Ensure the quantity available for variant if equal to 0 when there is only one- stock with warehouse without any shipping zone assigned.- """+ """Test that availability is 0 if no warehouses belong to a shipping zone."""# givenassert variant.stocks.count() == 1# clear shipping zones for variant warehouses@@ -381,8 +383,10 @@ def test_variant_quantity_available_with_country_code_only_negative_quantity(warehouse_for_cc,warehouse,):- """Ensure the quantity from the collection point without shipping zone is not- returned when the country code is given."""+ """Test that click-and-collect warehouse quantities are ignored when not part of the shipping zone.++ In this case, the non-C&C warehouse has negative quantity.+ """# givenquantity_cc = 7# stock for local collection point warehouse@@ -420,8 +424,10 @@ def test_variant_quantity_available_with_country_code_and_cc_warehouse_without_zwarehouse_for_cc,warehouse,):- """Ensure the quantity from the collection point without shipping zone is not- returned when the country code is given."""+ """Test that click-and-collect warehouse quantities are ignored when not part of the shipping zone.++ In this case, both quantities are positive.+ """# givenquantity_cc = 7# stock for local collection point warehouse@@ -455,8 +461,10 @@ def test_variant_quantity_available_with_country_code_and_cc_warehouse_without_zdef test_variant_quantity_available_with_country_code_and_local_cc_warehouse_with_zone(api_client, variant, channel_USD, warehouse_for_cc, warehouse, shipping_zone):- """Ensure the quantity from the local collection point without shipping zone- is returned."""+ """Test that availability includes click-and-collect warehouse that belongs to the shipping zone.++ In this case, both quantities are positive.+ """# givenquantity_cc = 7# stock for local collection point warehouse@@ -491,8 +499,10 @@ def test_variant_quantity_available_with_country_code_and_local_cc_warehouse_witdef test_variant_qty_available_with_country_code_and_local_cc_warehouse_negative_qty(api_client, variant, channel_USD, warehouse_for_cc, warehouse, shipping_zone):- """Ensure the quantity from the local collection point without shipping zone- is returned."""+ """Test that availability includes click-and-collect warehouse that belongs to the shipping zone.++ In this case, the non-C&C warehouse has negative quantity.+ """# givenquantity_cc = 7# stock for local collection point warehousediff --git a/saleor/graphql/shipping/tests/mutations/test_shipping_zone_create.py b/saleor/graphql/shipping/tests/mutations/test_shipping_zone_create.pyindex 4a918c1a80..fd94a2a35a 100644--- a/saleor/graphql/shipping/tests/mutations/test_shipping_zone_create.py+++ b/saleor/graphql/shipping/tests/mutations/test_shipping_zone_create.py@@ -317,8 +317,7 @@ def test_create_shipping_zone_invalid_warehouses_no_channels_assigned(def test_create_shipping_zone_invalid_warehouses(staff_api_client, warehouses, permission_manage_shipping, channel_PLN, channel_USD):- """Ensure an error is raised when warehouses without common channel- with the shipping zone are added."""+ """Test that a warehouses cannot be added to a shipping zone with no shared channels."""# givenwarehouse_ids = [graphene.Node.to_global_id("Warehouse", warehouse.pk)diff --git a/saleor/graphql/shipping/tests/mutations/test_shipping_zone_update.py b/saleor/graphql/shipping/tests/mutations/test_shipping_zone_update.pyindex 1dd4341959..21e886ef61 100644--- a/saleor/graphql/shipping/tests/mutations/test_shipping_zone_update.py+++ b/saleor/graphql/shipping/tests/mutations/test_shipping_zone_update.py@@ -570,8 +570,7 @@ def test_update_shipping_zone_add_invalid_warehouses(channel_PLN,channel_JPY,):- """Ensure an error is raised when the warehouse that has not a common- channel with shipping zone is added."""+ """Test that a warehouse can't be added to a shipping zone with no shared channels."""# givenshipping_id = graphene.Node.to_global_id("ShippingZone", shipping_zone.pk)# warehouse with common USD channel@@ -620,8 +619,7 @@ def test_update_shipping_zone_add_warehouse_without_any_channel(permission_manage_shipping,channel_PLN,):- """Ensure an error is raised when the warehouse that has not a common- channel with shipping zone is added."""+ """Test that warehouse cannot be added to a shipping zone that does not share any channels."""# givenshipping_id = graphene.Node.to_global_id("ShippingZone", shipping_zone.pk)@@ -659,8 +657,7 @@ def test_update_shipping_zone_add_warehouses_and_remove_common_channel(channel_USD,permission_manage_shipping,):- """Ensure an error is raised when the warehouse is added and common channel- with the shipping zone is removed."""+ """Test that a warehouse cannot be added to a shipping zone while removing all shared channels."""# givenshipping_id = graphene.Node.to_global_id("ShippingZone", shipping_zone.pk)warehouse_id = graphene.Node.to_global_id("Warehouse", warehouse.pk)@@ -696,8 +693,7 @@ def test_update_shipping_zone_remove_channels_remove_common_warehouse_channel(channel_PLN,permission_manage_shipping,):- """Ensure the shipping zone to channel relation is deleted when common channel- is removed from shipping zone."""+ """Test that the shipping zone to channel relation is deleted when the shipping zone is detached."""# givenshipping_id = graphene.Node.to_global_id("ShippingZone", shipping_zone.pk)channel_id = graphene.Node.to_global_id("Channel", channel_USD.pk)diff --git a/saleor/graphql/tests/test_context.py b/saleor/graphql/tests/test_context.pyindex 19f5eef3c5..37c5b4c366 100644--- a/saleor/graphql/tests/test_context.py+++ b/saleor/graphql/tests/test_context.py@@ -23,10 +23,7 @@ query orderById($id: ID!) {def test_user_is_cached_on_request(mocked_authenticate_user, api_client, order_with_lines, settings, staff_user):- """- This test case is added to cover edge case when user isn't cached on request- due to multiple Promises wait inside PluginBackend.authenticate method.- """+ """Test the edge case when user isn't cached due to multiple Promises waiting."""# givensettings.PLUGINS = ["saleor.plugins.tests.sample_plugins.SampleAuthorizationPlugin"]mocked_authenticate_user.return_value = staff_userdiff --git a/saleor/graphql/tests/utils.py b/saleor/graphql/tests/utils.pyindex 60fa55486b..57396378ff 100644--- a/saleor/graphql/tests/utils.py+++ b/saleor/graphql/tests/utils.py@@ -8,8 +8,9 @@ def get_graphql_content_from_response(response):def get_graphql_content(response, *, ignore_errors: bool = False):- """Gets GraphQL content from the response, and optionally checks if it- contains any operating-related errors, eg. schema errors or lack of+ """Extract GraphQL content from the API response.++ Optionally ignore protocol-level errors, eg. schema errors or lack ofpermissions."""content = get_graphql_content_from_response(response)diff --git a/saleor/graphql/utils/__init__.py b/saleor/graphql/utils/__init__.pyindex aa8b02ad61..31987f577a 100644--- a/saleor/graphql/utils/__init__.py+++ b/saleor/graphql/utils/__init__.py@@ -176,9 +176,8 @@ def _get_node_for_types_with_double_id(qs, pks, graphene_type):def format_permissions_for_display(permissions):"""Transform permissions queryset into Permission list.- Keyword Arguments:- permissions - queryset with permissions-+ Arguments:+ permissions: queryset with permissions"""permissions_data = permissions.annotate(formated_codename=Concat("content_type__app_label", Value("."), "codename")diff --git a/saleor/graphql/utils/sorting.py b/saleor/graphql/utils/sorting.pyindex ca41bacfdf..48d776dc03 100644--- a/saleor/graphql/utils/sorting.py+++ b/saleor/graphql/utils/sorting.py@@ -51,17 +51,18 @@ def sort_queryset() -> QuerySet:"""Sort queryset according to given parameters.- rules:+ Rules:- sorting_field and sorting_attribute cannot be together)- when sorting_attribute is passed, it is expected thatqueryset will have method to sort by attributes- when sorter has custom sorting method it's name must be like`prepare_qs_for_sort_{enum_name}` and it must return sorted queryset- Keyword Arguments:- queryset - queryset to be sorted- sort_by - dictionary with sorting field and direction-+ Arguments:+ channel_slug: channel to use for channel-specific sorting+ queryset: queryset to be sorted+ reversed: if True, sorting direction will be reversed+ sort_by: dictionary with sorting field and direction"""sorting_direction = sort_by.directionif reversed:diff --git a/saleor/order/migrations/0139_fulfil_orderline_token_old_id_created_at.py b/saleor/order/migrations/0139_fulfil_orderline_token_old_id_created_at.pyindex 4a6507a420..d65b9d1f94 100644--- a/saleor/order/migrations/0139_fulfil_orderline_token_old_id_created_at.py+++ b/saleor/order/migrations/0139_fulfil_orderline_token_old_id_created_at.py@@ -1,9 +1,9 @@# Generated by Django 3.2.12 on 2022-04-11 12:32-from django.db import migrations-from django.db.models import F, OuterRef, Subquery, Case, Whenfrom django.contrib.postgres.functions import RandomUUIDfrom django.contrib.postgres.operations import CryptoExtension+from django.db import migrations+from django.db.models import Case, F, OuterRef, Subquery, Whendef set_order_line_old_id_and_order_line_token_and_created_at(apps, _schema_editor):diff --git a/saleor/order/migrations/0140_fix_order_undiscounted_total.py b/saleor/order/migrations/0140_fix_order_undiscounted_total.pyindex a1e8146595..1fb86ebc76 100644--- a/saleor/order/migrations/0140_fix_order_undiscounted_total.py+++ b/saleor/order/migrations/0140_fix_order_undiscounted_total.py@@ -1,11 +1,12 @@# Generated by Django 3.2.16 on 2022-12-15 09:02-from functools import partialfrom collections import defaultdict+from functools import partialfrom django.apps import apps as registryfrom django.db import migrationsfrom django.db.models import Exists, F, OuterReffrom django.db.models.signals import post_migrate+from saleor.order.tasks import send_order_updatedBATCH_SIZE = 500diff --git a/saleor/order/migrations/0142_alter_fulfillmentline_line.py b/saleor/order/migrations/0142_alter_fulfillmentline_line.pyindex 11c9a017e9..68c2321b3a 100644--- a/saleor/order/migrations/0142_alter_fulfillmentline_line.py+++ b/saleor/order/migrations/0142_alter_fulfillmentline_line.py@@ -1,7 +1,7 @@# Generated by Django 3.2.12 on 2022-04-12 13:51-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/order/migrations/0143_update_orderline_pk.py b/saleor/order/migrations/0143_update_orderline_pk.pyindex c77e4cf99f..be37d35e7d 100644--- a/saleor/order/migrations/0143_update_orderline_pk.py+++ b/saleor/order/migrations/0143_update_orderline_pk.py@@ -1,8 +1,9 @@# Generated by Django 3.2.12 on 2022-04-13 07:27-from django.db import migrations, modelsimport uuid+from django.db import migrations, models+class Migration(migrations.Migration):dependencies = [diff --git a/saleor/order/migrations/0144_rewrite_fulfillmentline_orderline_relation.py b/saleor/order/migrations/0144_rewrite_fulfillmentline_orderline_relation.pyindex 575fca5a11..2613bbfb40 100644--- a/saleor/order/migrations/0144_rewrite_fulfillmentline_orderline_relation.py+++ b/saleor/order/migrations/0144_rewrite_fulfillmentline_orderline_relation.py@@ -1,7 +1,7 @@# Generated by Django 3.2.12 on 2022-04-13 07:33-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/order/migrations/0150_update_authorize_and_charge_status.py b/saleor/order/migrations/0150_update_authorize_and_charge_status.pyindex f2a82765ad..62142e45a0 100644--- a/saleor/order/migrations/0150_update_authorize_and_charge_status.py+++ b/saleor/order/migrations/0150_update_authorize_and_charge_status.py@@ -1,7 +1,7 @@# Generated by Django 3.2.13 on 2022-05-19 11:21from django.db import migrations-from django.db.models import F, Case, When, Value+from django.db.models import Case, F, Value, Whendef update_authorize_and_charge_status(apps, _schema_editor):diff --git a/saleor/order/migrations/0152_update_order_search_vector.py b/saleor/order/migrations/0152_update_order_search_vector.pyindex 9f0de90842..742a78a2d3 100644--- a/saleor/order/migrations/0152_update_order_search_vector.py+++ b/saleor/order/migrations/0152_update_order_search_vector.py@@ -1,6 +1,6 @@+from django.apps import apps as registryfrom django.db import migrationsfrom django.db.models.signals import post_migrate-from django.apps import apps as registryfrom ...core.search_tasks import set_order_search_document_valuesdiff --git a/saleor/order/migrations/0154_auto_20220621_0850.py b/saleor/order/migrations/0154_auto_20220621_0850.pyindex 7e230a84f5..f98bdb6a46 100644--- a/saleor/order/migrations/0154_auto_20220621_0850.py+++ b/saleor/order/migrations/0154_auto_20220621_0850.py@@ -2,6 +2,7 @@import django.contrib.postgres.indexesfrom django.db import migrations, models+import saleor.core.utils.json_serializerdiff --git a/saleor/order/migrations/0157_order_base_shipping_price_amount.py b/saleor/order/migrations/0157_order_base_shipping_price_amount.pyindex ee1dac3d47..74a3e25c64 100644--- a/saleor/order/migrations/0157_order_base_shipping_price_amount.py+++ b/saleor/order/migrations/0157_order_base_shipping_price_amount.py@@ -1,6 +1,7 @@# Generated by Django 4.0.7 on 2022-09-20 09:40from decimal import Decimal+from django.db import migrations, modelsdiff --git a/saleor/order/migrations/0159_order_shipping_tax_class_and_more.py b/saleor/order/migrations/0159_order_shipping_tax_class_and_more.pyindex 775f2f2fca..0342516264 100644--- a/saleor/order/migrations/0159_order_shipping_tax_class_and_more.py+++ b/saleor/order/migrations/0159_order_shipping_tax_class_and_more.py@@ -1,7 +1,8 @@# Generated by Django 4.0.7 on 2022-10-20 11:55-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, models+import saleor.core.utils.json_serializerdiff --git a/saleor/order/migrations/0162_order_granted_refund.py b/saleor/order/migrations/0162_order_granted_refund.pyindex 17272c1e13..1a236ed208 100644--- a/saleor/order/migrations/0162_order_granted_refund.py+++ b/saleor/order/migrations/0162_order_granted_refund.py@@ -1,7 +1,8 @@from decimal import Decimal-from django.db import migrations, models+import django.db.models.deletionimport django.utils.timezone+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/order/migrations/0163_order_events_rename_transaction_events.py b/saleor/order/migrations/0163_order_events_rename_transaction_events.pyindex 5733ac6890..10bd4d6d23 100644--- a/saleor/order/migrations/0163_order_events_rename_transaction_events.py+++ b/saleor/order/migrations/0163_order_events_rename_transaction_events.py@@ -1,7 +1,7 @@from django.db import migrations, transactionfrom django.db.models import QuerySet-from ..models import OrderEvent+from ..models import OrderEventBATCH_SIZE = 5000diff --git a/saleor/order/migrations/0168_order_bulk_permission.py b/saleor/order/migrations/0168_order_bulk_permission.pyindex e8fee9baf9..399e8955b8 100644--- a/saleor/order/migrations/0168_order_bulk_permission.py+++ b/saleor/order/migrations/0168_order_bulk_permission.py@@ -1,6 +1,6 @@# Generated by Django 3.2.18 on 2023-03-21 10:09-from django.db import migrationsfrom django.apps import apps as registry+from django.db import migrationsfrom django.db.models.signals import post_migratediff --git a/saleor/order/migrations/0170_auto_20230529_1314.py b/saleor/order/migrations/0170_auto_20230529_1314.pyindex 821db2e43a..c753984865 100644--- a/saleor/order/migrations/0170_auto_20230529_1314.py+++ b/saleor/order/migrations/0170_auto_20230529_1314.py@@ -1,7 +1,7 @@# Generated by Django 3.2.19 on 2023-05-29 13:14-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/order/migrations/0173_auto_20230816_1245.py b/saleor/order/migrations/0173_auto_20230816_1245.pyindex fc6a318c50..4a3df65d5e 100644--- a/saleor/order/migrations/0173_auto_20230816_1245.py+++ b/saleor/order/migrations/0173_auto_20230816_1245.py@@ -1,7 +1,7 @@# Generated by Django 3.2.20 on 2023-08-16 12:45-from django.contrib.postgres.operations import AddIndexConcurrentlyfrom django.contrib.postgres.indexes import BTreeIndex+from django.contrib.postgres.operations import AddIndexConcurrentlyfrom django.db import migrationsdiff --git a/saleor/order/migrations/0174_order_idx_order_created_at.py b/saleor/order/migrations/0174_order_idx_order_created_at.pyindex 2dd6c561b3..0c7066bd68 100644--- a/saleor/order/migrations/0174_order_idx_order_created_at.py+++ b/saleor/order/migrations/0174_order_idx_order_created_at.py@@ -1,7 +1,7 @@# Generated by Django 3.2.20 on 2023-08-31 17:45-from django.db import migrations, modelsfrom django.contrib.postgres.operations import AddIndexConcurrently+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/order/tests/test_calculations.py b/saleor/order/tests/test_calculations.pyindex c5a6943b5c..746f9bcfd8 100644--- a/saleor/order/tests/test_calculations.py+++ b/saleor/order/tests/test_calculations.py@@ -357,9 +357,7 @@ def test_recalculate_order_prices_order_discounts_and_total_undiscounted_price_cdef test_update_order_discounts_and_base_undiscounted_total_shipping_price_changed(draft_order, order_lines, shipping_method_weight_based):- """Ensure that the order discounts and order base undiscounted price is properly- updated after changing the shipping price.- """+ """Test that discounts are properly updated when shipping price changes."""# givenorder = draft_ordercurrency = order.currency@@ -408,9 +406,7 @@ def test_update_order_discounts_and_base_undiscounted_total_shipping_price_changdef test_update_order_discounts_and_base_undiscounted_total_line_quantity_changed(draft_order, order_lines, shipping_method_weight_based):- """Ensure that the order discounts and order base undiscounted price is properly- updated after changing the line quantity- """+ """Test that discounts are properly updated when line quantities change."""# givenorder = draft_orderdiff --git a/saleor/order/tests/test_fulfillments_actions.py b/saleor/order/tests/test_fulfillments_actions.pyindex a18c453323..42869a88f4 100644--- a/saleor/order/tests/test_fulfillments_actions.py+++ b/saleor/order/tests/test_fulfillments_actions.py@@ -677,10 +677,7 @@ def test_create_fulfillments_quantity_allocated_lower_than_line_quantity(warehouse,site_settings,):- """Ensure that when for some lines quantity allocated is lower than line quantity- and an error is raised during the deallocation uantity allocated value for- all allocation will be updated."""-+ """Test that stock allocation is immune to overselling."""# givenorder = order_with_linesorder_line1, order_line2 = order.lines.all()diff --git a/saleor/order/tests/test_order_actions.py b/saleor/order/tests/test_order_actions.pyindex d1cb987b4b..1bb89804e5 100644--- a/saleor/order/tests/test_order_actions.py+++ b/saleor/order/tests/test_order_actions.py@@ -160,8 +160,7 @@ def test_handle_fully_paid_order_gift_cards_created(non_shippable_gift_card_product,shippable_gift_card_product,):- """Ensure the non shippable gift card are fulfilled when the flag for automatic- fulfillment non shippable gift card is set."""+ """Test that digital gift cards are issued when automatic fulfillment is enabled."""# givenchannel = order_with_lines.channelchannel.automatically_fulfill_non_shippable_gift_card = True@@ -232,8 +231,7 @@ def test_handle_fully_paid_order_gift_cards_not_created(non_shippable_gift_card_product,shippable_gift_card_product,):- """Ensure the non shippable gift card are not fulfilled when the flag for- automatic fulfillment non shippable gift card is not set."""+ """Ensure digital gift cards are not issued when automatic fulfillment is disabled."""# givenchannel = order_with_lines.channelchannel.automatically_fulfill_non_shippable_gift_card = Falsediff --git a/saleor/page/migrations/0017_pagetype.py b/saleor/page/migrations/0017_pagetype.pyindex a668a66b18..a6cfd0b637 100644--- a/saleor/page/migrations/0017_pagetype.py+++ b/saleor/page/migrations/0017_pagetype.py@@ -1,7 +1,7 @@import django.db.models.deletion+from django.apps import apps as registryfrom django.db import migrations, modelsfrom django.db.models.signals import post_migrate-from django.apps import apps as registryimport saleor.core.utils.json_serializerdiff --git a/saleor/page/migrations/0028_add_default_page_type.py b/saleor/page/migrations/0028_add_default_page_type.pyindex 62c7f06b8b..eab7f7dcc1 100644--- a/saleor/page/migrations/0028_add_default_page_type.py+++ b/saleor/page/migrations/0028_add_default_page_type.py@@ -1,7 +1,7 @@# Generated by Django 3.2.16 on 2022-12-20 14:39-from django.db import migrationsfrom django.conf import settings+from django.db import migrationsdef create_default_page_type(apps, schema_editor):diff --git a/saleor/payment/gateways/adyen/tests/webhooks/test_handle_notifications.py b/saleor/payment/gateways/adyen/tests/webhooks/test_handle_notifications.pyindex d836c6b15f..1f60a51afe 100644--- a/saleor/payment/gateways/adyen/tests/webhooks/test_handle_notifications.py+++ b/saleor/payment/gateways/adyen/tests/webhooks/test_handle_notifications.py@@ -611,11 +611,7 @@ def test_handle_authorization_with_adyen_auto_capture(def test_handle_authorization_with_adyen_auto_capture_and_inactive_payment(refund_mock, notification, adyen_plugin, inactive_payment_adyen_for_checkout):- """- Ensure that the refund method is called and the new capture transaction is created,- when the payment is inactive and there is no success capture transaction for this- payment.- """+ """Test that refund is called for inactive payments without an existing capture transaction."""# givenpayment = inactive_payment_adyen_for_checkoutpayment_id = graphene.Node.to_global_id("Payment", payment.pk)@@ -643,10 +639,7 @@ def test_handle_authorization_with_adyen_auto_capture_and_inactive_payment(def test_handle_authorization_adyen_auto_capture_inactive_payment_and_captured_txn(refund_mock, notification, adyen_plugin, inactive_payment_adyen_for_checkout):- """- Ensure that the refund method is called and the new capture transaction- is not created, when the payment is inactive and already has capture transaction.- """+ """Test that refund is called on inactive payments with existing capture transactions."""# givenpayment = inactive_payment_adyen_for_checkoutpsp_reference = "ABC"@@ -909,11 +902,7 @@ def test_handle_capture_inactive_payment(address,shipping_method,):- """- Ensure that the refund method is called and the new capture transaction is created,- when the payment is inactive and there is no success capture transaction for this- payment.- """+ """Test that refund is called on inactive payments without an existing capture transaction."""# givenpayment = inactive_payment_adyen_for_checkoutpayment_id = graphene.Node.to_global_id("Payment", payment.pk)@@ -946,10 +935,7 @@ def test_handle_capture_inactive_payment_capture_txn_exists(address,shipping_method,):- """- Ensure that the refund method is called and the new capture transaction- is not created, when the payment is inactive and already has capture transaction.- """+ """Test that refund is called on inactive payments with existing capture transactions."""# givenpayment = inactive_payment_adyen_for_checkoutpsp_reference = "ABC"@@ -992,9 +978,7 @@ def test_handle_capture_for_checkout_order_not_created_checkout_line_variant_deladdress,shipping_method,):- """- Ensure that payment is not captured when one of checkout line variant is deleted.- """+ """Ensure that payment is not captured when a checkout line variant is deleted."""# givencheckout = payment_adyen_for_checkout.checkoutdiff --git a/saleor/payment/gateways/authorize_net/tests/test_authorize_net.py b/saleor/payment/gateways/authorize_net/tests/test_authorize_net.pyindex e72b5f329c..7ff068148c 100644--- a/saleor/payment/gateways/authorize_net/tests/test_authorize_net.py+++ b/saleor/payment/gateways/authorize_net/tests/test_authorize_net.py@@ -214,10 +214,7 @@ def test_void(authorize_net_payment, authorize_net_gateway_config):@pytest.mark.integration@pytest.mark.vcr()def test_void_duplicate(authorize_net_payment, authorize_net_gateway_config):- """- Tests already voided transaction- Authorize.net considers this a successful transaction- """+ """Test that duplicate voids are considered successful."""payment_data = PaymentData(authorize_net_payment.gateway,None,@@ -243,7 +240,7 @@ def test_void_duplicate(authorize_net_payment, authorize_net_gateway_config):@pytest.mark.integration@pytest.mark.vcr()def test_void_failure(authorize_net_payment, authorize_net_gateway_config):- """Test with invalid transaction id"""+ """Test void with invalid transaction ID."""payment_data = PaymentData(authorize_net_payment.gateway,None,diff --git a/saleor/payment/migrations/0035_auto_20220421_0615.py b/saleor/payment/migrations/0035_auto_20220421_0615.pyindex f5641c9be1..7839743353 100644--- a/saleor/payment/migrations/0035_auto_20220421_0615.py+++ b/saleor/payment/migrations/0035_auto_20220421_0615.py@@ -1,10 +1,12 @@# Generated by Django 3.2.12 on 2022-04-21 06:15from decimal import Decimal+import django.contrib.postgres.fieldsimport django.contrib.postgres.indexes-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, models+import saleor.core.utils.json_serializerdiff --git a/saleor/payment/migrations/0038_auto_20230223_0926.py b/saleor/payment/migrations/0038_auto_20230223_0926.pyindex c09fda6d72..44707b7062 100644--- a/saleor/payment/migrations/0038_auto_20230223_0926.py+++ b/saleor/payment/migrations/0038_auto_20230223_0926.py@@ -1,7 +1,8 @@from decimal import Decimal++import django.db.models.deletionfrom django.db import migrations, modelsfrom django.utils import timezone-import django.db.models.deletionclass Migration(migrations.Migration):diff --git a/saleor/payment/migrations/0043_drop_from_state_renamed_fields.py b/saleor/payment/migrations/0043_drop_from_state_renamed_fields.pyindex 5a0f866f07..ed724aa36a 100644--- a/saleor/payment/migrations/0043_drop_from_state_renamed_fields.py+++ b/saleor/payment/migrations/0043_drop_from_state_renamed_fields.py@@ -1,4 +1,5 @@from decimal import Decimal+from django.db import migrations, modelsdiff --git a/saleor/payment/tests/test_gateway.py b/saleor/payment/tests/test_gateway.pyindex 86b7a678d0..b85db87318 100644--- a/saleor/payment/tests/test_gateway.py+++ b/saleor/payment/tests/test_gateway.py@@ -1082,8 +1082,7 @@ def test_request_cancelation_action_on_checkout(@patch("saleor.payment.gateway.void")@patch("saleor.payment.gateway.refund")def test_payment_refund_or_void_no_payment(refund_mock, void_mock):- """Ensure that either refund or void method is not called when- there is no payment object."""+ """Test that neither refund nor void is called when there is no payment object."""# whengateway.payment_refund_or_void(None, get_plugins_manager(), None)@@ -1094,8 +1093,7 @@ def test_payment_refund_or_void_no_payment(refund_mock, void_mock):@patch("saleor.payment.gateway.refund")def test_payment_refund_or_void_refund_called(refund_mock, payment):- """Ensure that the refund method is called when payment can be refunded- and there is no refund transaction."""+ """Test that refund is called when there is no matching transaction."""# givenpayment.transactions.count() == 0payment.charge_status = ChargeStatus.FULLY_CHARGED@@ -1112,9 +1110,7 @@ def test_payment_refund_or_void_refund_called(refund_mock, payment):def test_payment_refund_or_void_refund_not_called_refund_already_started(refund_mock, payment):- """Ensure that the refund method is not called when the refund process- is already ongoing - there is a `REFUND_ONGOING` transaction with- the given transaction_id."""+ """Test that refund is not called if a matching transaction already exists."""# givenpayment.charge_status = ChargeStatus.FULLY_CHARGEDpayment.save(update_fields=["charge_status"])@@ -1140,8 +1136,7 @@ def test_payment_refund_or_void_refund_not_called_refund_already_started(@patch("saleor.payment.gateway.refund")def test_payment_refund_or_void_refund_called_txn_exist(refund_mock, payment):- """Ensure that the refund method is called when the refund process- is already ongoing but not covered full payment captured amount."""+ """Test that refund is called when existing transactions don't cover the captured amount."""# givenpayment.charge_status = ChargeStatus.FULLY_CHARGEDpayment.save(update_fields=["charge_status"])@@ -1171,8 +1166,7 @@ def test_payment_refund_or_void_refund_called_txn_exist(refund_mock, payment):def test_payment_refund_or_void_refund_called_no_txn_with_given_transaction_id(refund_mock, payment):- """Ensure that the refund method is called when payment has the refund ongoing- transaction but with different transaction_id that was provided."""+ """Test that refund is called when unrelated refund transactions exist."""# givenpayment.charge_status = ChargeStatus.FULLY_CHARGEDpayment.save(update_fields=["charge_status"])@@ -1200,8 +1194,7 @@ def test_payment_refund_or_void_refund_called_no_txn_with_given_transaction_id(@patch("saleor.payment.gateway.void")def test_payment_refund_or_void_void_called(void_mock, payment):- """Ensure that the refund method is called when payment can be voided- and there is no void transaction for given payment."""+ """Test that void is called when there is no matching transaction."""# givenpayment.can_void = Mock(return_value=True)assert payment.can_void() is True@@ -1216,8 +1209,7 @@ def test_payment_refund_or_void_void_called(void_mock, payment):@patch("saleor.payment.gateway.void")def test_payment_refund_or_void_void_not_called_txn_exist(void_mock, payment):- """Ensure that void method is not called when VOID transaction already exists with- given transaction_id."""+ """Test that void is not called if a matching void transaction already exists."""# givenpayment.can_void = Mock(return_value=True)assert payment.can_refund() is Falsediff --git a/saleor/permission/management.py b/saleor/permission/management.pyindex b655ad6bec..19e6b878fc 100644--- a/saleor/permission/management.py+++ b/saleor/permission/management.py@@ -5,15 +5,13 @@ from django.db import DEFAULT_DB_ALIAS, routerdef _get_all_permissions(opts): # noqa: D200, D212- """- Return (codename, name) for all permissions in the given opts.- """+ """Return (codename, name) for all permissions in the given opts."""return [*_get_builtin_permissions(opts), *opts.permissions]def _get_builtin_permissions(opts): # noqa: D205, D212- """- Return (codename, name) for all autogenerated permissions.+ """Return (codename, name) for all autogenerated permissions.+By default, this is ('add', 'change', 'delete', 'view')"""perms = []diff --git a/saleor/permission/migrations/0001_initial.py b/saleor/permission/migrations/0001_initial.pyindex 5ca3d88d9d..e2e4918c25 100644--- a/saleor/permission/migrations/0001_initial.py+++ b/saleor/permission/migrations/0001_initial.py@@ -1,8 +1,8 @@# Generated by Django 3.2.16 on 2022-11-22 11:20from django.db import migrations, models-import saleor.permission.models+import saleor.permission.models# Forward helpersDROP_OLD_CONSTRAINTS = """diff --git a/saleor/permission/migrations/0002_alter_permission_content_type.py b/saleor/permission/migrations/0002_alter_permission_content_type.pyindex 580987c8d1..5616dd04f2 100644--- a/saleor/permission/migrations/0002_alter_permission_content_type.py+++ b/saleor/permission/migrations/0002_alter_permission_content_type.py@@ -1,7 +1,7 @@# Generated by Django 3.2.16 on 2022-12-21 12:44-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/permission/models.py b/saleor/permission/models.pyindex dc1fa2dc2a..bbe89636a5 100644--- a/saleor/permission/models.py+++ b/saleor/permission/models.py@@ -18,19 +18,6 @@ def _user_has_perm(user, perm, obj):return False-def _user_has_module_perms(user, app_label):- """Backend can raise `PermissionDenied` to short-circuit permission checking."""- for backend in auth.get_backends():- if not hasattr(backend, "has_module_perms"):- continue- try:- if backend.has_module_perms(user, app_label):- return True- except PermissionDenied:- return False- return False--def _user_get_permissions(user, obj, from_name):permissions = set()name = "get_%s_permissions" % from_name@@ -101,10 +88,7 @@ class Permission(models.Model):class PermissionsMixin(models.Model): # noqa: D205, D212, D400, D415- """- Add the fields and methods necessary to support the Group and Permission- models using the ModelBackend.- """+ """Add the fields and methods necessary to support permissions."""is_superuser = models.BooleanField(_("superuser status"),@@ -138,18 +122,18 @@ class PermissionsMixin(models.Model): # noqa: D205, D212, D400, D415abstract = Truedef get_user_permissions(self, obj=None): # noqa: D205, D212- """- Return a list of permission strings that this user has directly.- Query all available auth backends. If an object is passed in,- return only permissions matching this object.+ """Return a list of permission strings that this user has directly.++ Query all available auth backends. If an object is passed in, return only+ permissions matching this object."""return _user_get_permissions(self, obj, "user")def get_group_permissions(self, obj=None): # noqa: D205, D212, D400, D415- """- Return a list of permission strings that this user has through their- groups. Query all available auth backends. If an object is passed in,- return only permissions matching this object.+ """Return a list of permission strings that this user has through their groups.++ Query all available auth backends. If an object is passed in, return only+ permissions matching this object."""return _user_get_permissions(self, obj, "group")@@ -157,10 +141,10 @@ class PermissionsMixin(models.Model): # noqa: D205, D212, D400, D415return _user_get_permissions(self, obj, "all")def has_perm(self, perm, obj=None): # noqa: D205, D212, D400, D415- """- Return True if the user has the specified permission. Query all- available auth backends, but return immediately if any backend returns- True. Thus, a user who has permission from a single auth backend is+ """Return True if the user has the specified permission.++ Query all available auth backends, but return immediately if any backend+ returns True. Thus, a user who has permission from a single auth backend isassumed to have permission in general. If an object is provided, checkpermissions for that object."""@@ -172,19 +156,8 @@ class PermissionsMixin(models.Model): # noqa: D205, D212, D400, D415return _user_has_perm(self, perm, obj)def has_perms(self, perm_list, obj=None): # noqa: D205, D212, D400, D415- """- Return True if the user has each of the specified permissions. If- object is passed, check if the user has all required perms for it.- """- return all(self.has_perm(perm, obj) for perm in perm_list)+ """Return True if the user has each of the specified permissions.- def has_module_perms(self, app_label): # noqa: D205, D212+ If an object is passed, check if the user has all required perms for it."""- Return True if the user has any permissions in the given app label.- Use similar logic as has_perm(), above.- """- # Active superusers have all permissions.- if self.is_active and self.is_superuser: # type: ignore[attr-defined] # mixin- return True-- return _user_has_module_perms(self, app_label)+ return all(self.has_perm(perm, obj) for perm in perm_list)diff --git a/saleor/plugins/avatax/tests/test_avatax.py b/saleor/plugins/avatax/tests/test_avatax.pyindex d55d036279..7c643b47cd 100644--- a/saleor/plugins/avatax/tests/test_avatax.py+++ b/saleor/plugins/avatax/tests/test_avatax.py@@ -1578,8 +1578,7 @@ def test_calculate_checkout_total_voucher_on_entire_order(address,plugin_configuration,):- """Ensure that the voucher is applied to entire order the total- is equal to the shipping price."""+ """Check that the totals are correct when the checkout is 100% off."""# givenplugin_configuration()variant = stock.product_variant@@ -1630,8 +1629,10 @@ def test_calculate_checkout_total_voucher_on_entire_order_applied_once_per_orderaddress,plugin_configuration,):- """Ensure that the voucher is applied to entire order the total- is equal to the shipping price."""+ """Test that the totals are correct when the checkout is 100% off.++ In this case, the voucher is applied once per order.+ """# givenplugin_configuration()variant = stock.product_variant@@ -1698,8 +1699,7 @@ def test_calculate_checkout_total_voucher_on_entire_order_product_without_taxes(address,plugin_configuration,):- """Ensure that the voucher is applied to entire order the total- is equal to the shipping price."""+ """Test that the totals are correct when the product is 100% off."""# givenplugin_configuration()variant = stock.product_variant@@ -1768,8 +1768,7 @@ def test_calculate_checkout_total_voucher_on_shipping(shipping_zone,plugin_configuration,):- """Ensure that when the free shipping voucher is applied the total price- is equal to subtotal price."""+ """Test that free shipping results in correct checkout totals."""# givenplugin_configuration()monkeypatch.setattr(@@ -2085,8 +2084,7 @@ def test_calculate_checkout_subtotal_voucher_on_entire_order(address,plugin_configuration,):- """Ensure that the voucher is applied to entire order the subtotal price- is equal to zero."""+ """Test that a voucher covering the total properly discounts the subtotal price to zero."""# givenplugin_configuration()variant = stock.product_variant@@ -2144,8 +2142,7 @@ def test_calculate_checkout_subtotal_voucher_on_shipping(address,plugin_configuration,):- """Ensure that when the free shipping voucher is applied the subtotal price- not changed."""+ """That that free shipping does not affect the subtotal price."""# givenplugin_configuration()monkeypatch.setattr(@@ -4420,8 +4417,7 @@ def test_get_order_request_data_uses_correct_address_for_cc_with_single_locationdef test_get_order_request_data_for_line_with_already_included_taxes_in_price(order_with_lines, shipping_zone, avatax_config):- """Ensure that when line already has calculated taxes, the `taxIncluded` flag- is set based on site settings, and we are sending the base price of line."""+ """Test that net price is used when appropriate even if taxes are already known."""# givenprices_entered_with_tax = Falsetax_configuration = order_with_lines.channel.tax_configuration@@ -4666,8 +4662,7 @@ def test_get_order_request_data_draft_order_with_shipping_voucher(def test_get_order_request_data_draft_order_shipping_voucher_amount_too_high(order_with_lines, shipping_zone, voucher_free_shipping, avatax_config):- """Ensure that when order has shipping voucher with price bigger than shipping- price, the shipping price will not be negative."""+ """Test discount behavior when the voucher amount is higher than the order total."""# giventax_configuration = order_with_lines.channel.tax_configurationtax_configuration.prices_entered_with_tax = Truediff --git a/saleor/plugins/openid_connect/tests/test_ip_filtering.py b/saleor/plugins/openid_connect/tests/test_ip_filtering.pyindex fc699528c0..0b53becee3 100644--- a/saleor/plugins/openid_connect/tests/test_ip_filtering.py+++ b/saleor/plugins/openid_connect/tests/test_ip_filtering.py@@ -6,9 +6,7 @@ from ....core.http_client import HTTPClientdef test_rejects_private_ips(openid_plugin, id_token, rf, monkeypatch):- """- Ensure non-public IP addresses are rejected in HTTP calls in the OAuth plugin.- """+ """Ensure private IP addresses are rejected by OIDC."""monkeypatch.setattr(HTTPClient.config, "ip_filter_enable", True)plugin = openid_plugin(oauth_token_url="https://0.0.0.0")diff --git a/saleor/plugins/webhook/tests/test_webhook_ip_filtering.py b/saleor/plugins/webhook/tests/test_webhook_ip_filtering.pyindex 58b21d57be..b832eefc25 100644--- a/saleor/plugins/webhook/tests/test_webhook_ip_filtering.py+++ b/saleor/plugins/webhook/tests/test_webhook_ip_filtering.py@@ -4,9 +4,7 @@ from ....webhook.transport.asynchronous.transport import trigger_webhooks_asyncdef test_rejects_private_ips(webhook, monkeypatch):- """- Ensure non-public IP addresses are rejected in HTTP calls in the webhook plugin.- """+ """Ensure private IP addresses are rejected by webhooks."""# Enable IP filtermonkeypatch.setattr(HTTPClient.config, "ip_filter_enable", True)diff --git a/saleor/product/migrations/0129_add_product_types_and_attributes_perm.py b/saleor/product/migrations/0129_add_product_types_and_attributes_perm.pyindex de2a6370a2..229c90e203 100644--- a/saleor/product/migrations/0129_add_product_types_and_attributes_perm.py+++ b/saleor/product/migrations/0129_add_product_types_and_attributes_perm.py@@ -1,8 +1,8 @@# Generated by Django 3.1 on 2020-10-16 09:16+from django.apps import apps as registryfrom django.db import migrationsfrom django.db.models.signals import post_migrate-from django.apps import apps as registrydef update_groups_with_manage_products_with_new_permission(apps, schema_editor):diff --git a/saleor/product/migrations/0169_alter_digitalcontenturl_line.py b/saleor/product/migrations/0169_alter_digitalcontenturl_line.pyindex 65b0caae38..e00e0bc686 100644--- a/saleor/product/migrations/0169_alter_digitalcontenturl_line.py+++ b/saleor/product/migrations/0169_alter_digitalcontenturl_line.py@@ -1,7 +1,7 @@# Generated by Django 3.2.12 on 2022-04-12 14:03-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/product/migrations/0170_rewrite_digitalcontenturl_orderline_relation.py b/saleor/product/migrations/0170_rewrite_digitalcontenturl_orderline_relation.pyindex 18c4a8105c..6b66c96c2f 100644--- a/saleor/product/migrations/0170_rewrite_digitalcontenturl_orderline_relation.py+++ b/saleor/product/migrations/0170_rewrite_digitalcontenturl_orderline_relation.py@@ -1,7 +1,7 @@# Generated by Django 3.2.12 on 2022-04-13 07:33-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/product/migrations/0173_create_default_category_and_product_type.py b/saleor/product/migrations/0173_create_default_category_and_product_type.pyindex 783d6de1ef..60c8293176 100644--- a/saleor/product/migrations/0173_create_default_category_and_product_type.py+++ b/saleor/product/migrations/0173_create_default_category_and_product_type.py@@ -1,5 +1,5 @@-from django.db import migrationsfrom django.conf import settings+from django.db import migrationsfrom ...product import ProductTypeKinddiff --git a/saleor/product/migrations/0175_alter_productmedia_product.py b/saleor/product/migrations/0175_alter_productmedia_product.pyindex 3a3aee9ab9..0db2f73eb4 100644--- a/saleor/product/migrations/0175_alter_productmedia_product.py+++ b/saleor/product/migrations/0175_alter_productmedia_product.py@@ -1,7 +1,7 @@# Generated by Django 3.2.14 on 2022-07-19 13:38-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/product/migrations/0177_product_tax_class_producttype_tax_class.py b/saleor/product/migrations/0177_product_tax_class_producttype_tax_class.pyindex d49cd97cc2..505d9e9ee3 100644--- a/saleor/product/migrations/0177_product_tax_class_producttype_tax_class.py+++ b/saleor/product/migrations/0177_product_tax_class_producttype_tax_class.py@@ -1,7 +1,7 @@# Generated by Django 4.0.7 on 2022-10-26 09:46-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/product/migrations/0178_fix_description_plaintext_field.py b/saleor/product/migrations/0178_fix_description_plaintext_field.pyindex 34a48fd5ae..068a8d0bb0 100644--- a/saleor/product/migrations/0178_fix_description_plaintext_field.py+++ b/saleor/product/migrations/0178_fix_description_plaintext_field.py@@ -2,6 +2,7 @@from django.db import migrationsfrom django.db.models import Q+from ...core.utils.editorjs import clean_editor_jsBATCH_SIZE = 2000diff --git a/saleor/product/migrations/0180_productmedia_metadata.py b/saleor/product/migrations/0180_productmedia_metadata.pyindex a6e8f0a170..df437c88a0 100644--- a/saleor/product/migrations/0180_productmedia_metadata.py+++ b/saleor/product/migrations/0180_productmedia_metadata.py@@ -2,6 +2,7 @@import django.contrib.postgres.indexesfrom django.db import migrations, models+import saleor.core.utils.json_serializerdiff --git a/saleor/product/migrations/0183_calculate_discounted_prices.py b/saleor/product/migrations/0183_calculate_discounted_prices.pyindex eb971b5b6d..002ab73734 100644--- a/saleor/product/migrations/0183_calculate_discounted_prices.py+++ b/saleor/product/migrations/0183_calculate_discounted_prices.py@@ -1,16 +1,15 @@# Generated by Django 3.2.18 on 2023-05-05 07:46+from collections import defaultdict, namedtuple+from decimal import ROUND_HALF_UP+from functools import partial++import mptt+import mptt.managersfrom django.db import migrationsfrom django.db.models import Exists, OuterRef, Q-from collections import defaultdictfrom django.utils import timezone-from collections import namedtuplefrom prices import Money, fixed_discount, percentage_discount-from functools import partial-from decimal import ROUND_HALF_UP-import mptt-import mptt.managers-BATCH_SIZE = 500diff --git a/saleor/product/migrations/0184_product_product_gin.py b/saleor/product/migrations/0184_product_product_gin.pyindex 49998f8b37..0b190a5fb5 100644--- a/saleor/product/migrations/0184_product_product_gin.py+++ b/saleor/product/migrations/0184_product_product_gin.py@@ -1,8 +1,8 @@# Generated by Django 3.2.18 on 2023-05-29 11:25import django.contrib.postgres.indexes-from django.db import migrationsfrom django.contrib.postgres.operations import AddIndexConcurrently+from django.db import migrationsclass Migration(migrations.Migration):diff --git a/saleor/product/migrations/0187_auto_20230614_0838.py b/saleor/product/migrations/0187_auto_20230614_0838.pyindex 769c24b818..5237f5d571 100644--- a/saleor/product/migrations/0187_auto_20230614_0838.py+++ b/saleor/product/migrations/0187_auto_20230614_0838.py@@ -1,8 +1,9 @@# Generated by Django 3.2.19 on 2023-06-14 08:38from decimal import Decimal-from django.db import migrations, models+import django.db.models.deletion+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/product/migrations/0188_category_updated_at_idx.py b/saleor/product/migrations/0188_category_updated_at_idx.pyindex 8f310516ed..26ff5bbc83 100644--- a/saleor/product/migrations/0188_category_updated_at_idx.py+++ b/saleor/product/migrations/0188_category_updated_at_idx.py@@ -1,8 +1,8 @@# Generated by Django 3.2.20 on 2023-09-27 06:31import django.contrib.postgres.indexes-from django.db import migrationsfrom django.contrib.postgres.operations import AddIndexConcurrently+from django.db import migrationsclass Migration(migrations.Migration):diff --git a/saleor/product/tests/test_generate_and_set_variant_name.py b/saleor/product/tests/test_generate_and_set_variant_name.pyindex 4a0a15c30b..4abfe30da5 100644--- a/saleor/product/tests/test_generate_and_set_variant_name.py+++ b/saleor/product/tests/test_generate_and_set_variant_name.py@@ -41,9 +41,7 @@ def variant_with_no_attributes(category, channel_USD):def test_generate_and_set_variant_name_different_attributes(variant_with_no_attributes, color_attribute_without_values, size_attribute):- """Test the name generation from a given variant containing multiple attributes and- different input types (dropdown and multiselect).- """+ """Test variant name generation with a mix of mix of (non-)selection attributes."""variant = variant_with_no_attributescolor_attribute = color_attribute_without_values@@ -83,9 +81,7 @@ def test_generate_and_set_variant_name_different_attributes(def test_generate_and_set_variant_name_only_variant_selection_attributes(variant_with_no_attributes, color_attribute_without_values, size_attribute):- """Test the name generation for a given variant containing multiple attributes- with input types allowed in variant selection.- """+ """Test that selection attributes properly affect variant name generation."""variant = variant_with_no_attributescolor_attribute = color_attribute_without_values@@ -128,9 +124,7 @@ def test_generate_and_set_variant_name_only_variant_selection_attributes(def test_generate_and_set_variant_name_only_not_variant_selection_attributes(variant_with_no_attributes, color_attribute_without_values, file_attribute):- """Test the name generation for a given variant containing multiple attributes- with input types not allowed in variant selection.- """+ """Test that non-selection attributes don't affect variant name generation."""variant = variant_with_no_attributescolor_attribute = color_attribute_without_values@@ -170,8 +164,7 @@ def test_generate_and_set_variant_name_only_not_variant_selection_attributes(def test_generate_name_from_values_empty(variant_with_no_attributes):- """Ensure generate a variant name from a variant without any attributes assigned- returns an empty string."""+ """Ensure a variant name generated from no attributes is an empty string."""variant = variant_with_no_attributesgenerate_and_set_variant_name(variant, variant.sku)variant.refresh_from_db()diff --git a/saleor/product/tests/test_product.py b/saleor/product/tests/test_product.pyindex 5b32ace95b..24d907195d 100644--- a/saleor/product/tests/test_product.py+++ b/saleor/product/tests/test_product.py@@ -363,9 +363,7 @@ def test_get_price_overridden_price_with_discount(def test_digital_product_view(client, digital_content_url):- """Ensure a user (anonymous or not) can download a non-expired digital good- using its associated token and that all associated events- are correctly generated."""+ """Ensure a non-expired digital good can be downloaded and results in an event."""url = digital_content_url.get_absolute_url()response = client.get(url)@@ -390,8 +388,7 @@ def test_digital_product_increment_download(is_user_null,is_line_null,):- """Ensure downloading a digital good is possible without it- being associated to an order line/user."""+ """Ensure a digital good can be downloaded without it belonging to an order or user."""expected_user = customer_userdiff --git a/saleor/schedulers/migrations/0001_initial.py b/saleor/schedulers/migrations/0001_initial.pyindex 583bfdee75..2cc08fa8e1 100644--- a/saleor/schedulers/migrations/0001_initial.py+++ b/saleor/schedulers/migrations/0001_initial.py@@ -1,8 +1,8 @@# Generated by Django 3.2.14 on 2022-07-18 07:44+import django.db.models.deletionfrom django.apps.registry import Appsfrom django.db import migrations, models-import django.db.models.deletiondef delete_django_celery_beat_data(apps: Apps, _schema_editor):diff --git a/saleor/shipping/migrations/0032_shippingmethod_tax_class.py b/saleor/shipping/migrations/0032_shippingmethod_tax_class.pyindex a3cba63aef..0a5d373df3 100644--- a/saleor/shipping/migrations/0032_shippingmethod_tax_class.py+++ b/saleor/shipping/migrations/0032_shippingmethod_tax_class.py@@ -1,7 +1,7 @@# Generated by Django 4.0.7 on 2022-09-14 13:15-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/shipping/migrations/0033_add_default_shipping.py b/saleor/shipping/migrations/0033_add_default_shipping.pyindex ab35263b44..0d29f30cc5 100644--- a/saleor/shipping/migrations/0033_add_default_shipping.py+++ b/saleor/shipping/migrations/0033_add_default_shipping.py@@ -1,7 +1,7 @@# Generated by Django 3.2.16 on 2022-12-20 15:52-from django.db import migrationsfrom django.conf import settings+from django.db import migrationsfrom .. import ShippingMethodTypediff --git a/saleor/shipping/tests/test_shipping.py b/saleor/shipping/tests/test_shipping.pyindex 3c018d19a0..63ad836008 100644--- a/saleor/shipping/tests/test_shipping.py+++ b/saleor/shipping/tests/test_shipping.py@@ -118,12 +118,10 @@ def test_applicable_shipping_methods_country_code_outside_shipping_zone(assert method not in result-def test_applicable_shipping_methods_inproper_shipping_method_type(+def test_applicable_shipping_methods_improper_shipping_method_type(shipping_zone, channel_USD):- """Case when shipping suits the price requirements of the weight type- shipping method and the other way around.- """+ """Test price-based and weight-based shipping method qualification."""price_method = shipping_zone.shipping_methods.create(minimum_order_weight=Weight(kg=100),type=ShippingMethodType.WEIGHT_BASED,diff --git a/saleor/site/migrations/0038_auto_20230510_1107.py b/saleor/site/migrations/0038_auto_20230510_1107.pyindex da87b8c07b..c9973423e9 100644--- a/saleor/site/migrations/0038_auto_20230510_1107.py+++ b/saleor/site/migrations/0038_auto_20230510_1107.py@@ -1,6 +1,7 @@# Generated by Django 3.2.19 on 2023-05-10 11:07from django.db import migrations+from ...settings import get_bool_from_envdiff --git a/saleor/site/migrations/0039_auto_20230615_1754.py b/saleor/site/migrations/0039_auto_20230615_1754.pyindex c5f6e4f076..e628d0111b 100644--- a/saleor/site/migrations/0039_auto_20230615_1754.py+++ b/saleor/site/migrations/0039_auto_20230615_1754.py@@ -1,6 +1,7 @@# Generated by Django 3.2.19 on 2023-06-15 17:54from django.db import migrations, models+import saleor.core.utils.json_serializerdiff --git a/saleor/tax/migrations/0001_initial.py b/saleor/tax/migrations/0001_initial.pyindex fa4bddb1bd..a22706d781 100644--- a/saleor/tax/migrations/0001_initial.py+++ b/saleor/tax/migrations/0001_initial.py@@ -1,9 +1,10 @@# Generated by Django 4.0.7 on 2022-09-14 13:15-from django.db import migrations, modelsimport django.db.models.deletionimport django.db.models.expressionsimport django_countries.fields+from django.db import migrations, models+import saleor.core.utils.json_serializerdiff --git a/saleor/tax/migrations/0002_add_default_tax_configs.py b/saleor/tax/migrations/0002_add_default_tax_configs.pyindex 290e935777..f6e2d06e73 100644--- a/saleor/tax/migrations/0002_add_default_tax_configs.py+++ b/saleor/tax/migrations/0002_add_default_tax_configs.py@@ -4,7 +4,6 @@ from django.db import migrationsfrom .. import TaxCalculationStrategy-AVATAX_PLUGIN_ID = "mirumee.taxes.avalara"VATLAYER_ID = "mirumee.taxes.vatlayer"diff --git a/saleor/tax/migrations/0004_migrate_tax_classes.py b/saleor/tax/migrations/0004_migrate_tax_classes.pyindex 278b82f7a2..87d663d042 100644--- a/saleor/tax/migrations/0004_migrate_tax_classes.py+++ b/saleor/tax/migrations/0004_migrate_tax_classes.py@@ -1,10 +1,10 @@# Generated by Django 3.2.14 on 2022-07-27 16:05from collections import defaultdict-from django_countries import countries+from django.db import migrationsfrom django.db.models import Q-+from django_countries import countriesAVATAX_CODE_META_KEY = "avatax.code"AVATAX_DESCRIPTION_META_KEY = "avatax.description"diff --git a/saleor/tax/migrations/0005_migrate_vatlayer.py b/saleor/tax/migrations/0005_migrate_vatlayer.pyindex 45c64298c8..5b1a5535a1 100644--- a/saleor/tax/migrations/0005_migrate_vatlayer.py+++ b/saleor/tax/migrations/0005_migrate_vatlayer.py@@ -1,9 +1,9 @@# Generated by Django 3.2.14 on 2022-08-18 10:31from typing import List, Optional-from django_countries import countries-from django.db import migrations+from django.db import migrations+from django_countries import countriesVATLAYER_ID = "mirumee.taxes.vatlayer"diff --git a/saleor/tests/dummy_password_hasher.py b/saleor/tests/dummy_password_hasher.pyindex 761b1dda43..8f06296d77 100644--- a/saleor/tests/dummy_password_hasher.py+++ b/saleor/tests/dummy_password_hasher.py@@ -4,9 +4,11 @@ from django.contrib.auth.hashers import BasePasswordHasherclass DummyHasher(BasePasswordHasher):- """Dummy password hasher used only for unit tests purpose. Overwriting- default Django password hasher significantly reduces the time of tests- execution."""+ """Dummy password hasher used only for unit tests purpose.++ Overwriting default Django password hasher significantly reduces the time+ of test execution.+ """algorithm = "dummy"diff --git a/saleor/tests/e2e/utils.py b/saleor/tests/e2e/utils.pyindex 22df1fdab9..7fe08febdd 100644--- a/saleor/tests/e2e/utils.py+++ b/saleor/tests/e2e/utils.py@@ -1,6 +1,8 @@from ...account.models import Group-from ...graphql.tests.utils import get_graphql_content # noqa: F401-from ...graphql.tests.utils import get_multipart_request_body # noqa: F401+from ...graphql.tests.utils import (+ get_graphql_content, # noqa: F401+ get_multipart_request_body, # noqa: F401+)def assign_permissions(api_client, permissions):diff --git a/saleor/tests/fixtures.py b/saleor/tests/fixtures.pyindex 2b8a71c0a9..9afe003872 100644--- a/saleor/tests/fixtures.py+++ b/saleor/tests/fixtures.py@@ -178,9 +178,7 @@ class CaptureQueriesContext(BaseCaptureQueriesContext):def _assert_num_queries(context, *, config, num, exact=True, info=None):- """- Extracted from pytest_django.fixtures._assert_num_queries- """+ # Extracted from pytest_django.fixtures._assert_num_queriesyield contextverbose = config.getoption("verbose") > 0@@ -3776,12 +3774,13 @@ def product_with_image_list(product, image_list, media_root):@pytest.fixturedef product_with_image_list_and_one_null_sort_order(product_with_image_list):- """+ """Return a product with mixed sorting order.+As we allow to have `null` in `sort_order` in database, but our logiccovers changing any new `null` values to proper `int` need to execute- raw SQL query on database to test behaviour of `null` `sort_order`.+ raw SQL query on database to test behavior of `null` `sort_order`.- SQL query behaviour:+ SQL query behavior:Updates one of the product media `sort_order` to `null`."""with connection.cursor() as cursor:@@ -7742,7 +7741,7 @@ def event_payload():@pytest.fixturedef event_delivery(event_payload, webhook, app):- """Return event delivery object"""+ """Return an event delivery object."""return EventDelivery.objects.create(event_type=WebhookEventAsyncType.ANY,payload=event_payload,@@ -7752,7 +7751,7 @@ def event_delivery(event_payload, webhook, app):@pytest.fixturedef event_attempt(event_delivery):- """Return event delivery attempt object"""+ """Return an event delivery attempt object."""return EventDeliveryAttempt.objects.create(delivery=event_delivery,task_id="example_task_id",@@ -7825,7 +7824,7 @@ def check_payment_balance_input():@pytest.fixturedef delivery_attempts(event_delivery):- """Return consecutive deliveries attempts ids"""+ """Return consecutive delivery attempt IDs."""with freeze_time("2020-03-18 12:00:00"):attempt_1 = EventDeliveryAttempt.objects.create(delivery=event_delivery,@@ -7871,7 +7870,7 @@ def delivery_attempts(event_delivery):@pytest.fixturedef event_deliveries(event_payload, webhook, app):- """Return consecutive event deliveries ids"""+ """Return consecutive event delivery IDs."""delivery_1 = EventDelivery.objects.create(event_type=WebhookEventAsyncType.ANY,payload=event_payload,diff --git a/saleor/thumbnail/migrations/0001_initial.py b/saleor/thumbnail/migrations/0001_initial.pyindex 018e8efd62..afc53bd7a2 100644--- a/saleor/thumbnail/migrations/0001_initial.py+++ b/saleor/thumbnail/migrations/0001_initial.py@@ -1,8 +1,9 @@# Generated by Django 3.2.13 on 2022-06-09 06:40+import django.db.models.deletionfrom django.conf import settingsfrom django.db import migrations, models-import django.db.models.deletion+import saleor.thumbnail.modelsdiff --git a/saleor/warehouse/migrations/0023_alter_orderline_relations.py b/saleor/warehouse/migrations/0023_alter_orderline_relations.pyindex 2c7b37d42e..64d40ad798 100644--- a/saleor/warehouse/migrations/0023_alter_orderline_relations.py+++ b/saleor/warehouse/migrations/0023_alter_orderline_relations.py@@ -1,7 +1,7 @@# Generated by Django 3.2.12 on 2022-04-12 13:55-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/warehouse/migrations/0024_rewrite_order_line_relations.py b/saleor/warehouse/migrations/0024_rewrite_order_line_relations.pyindex 337749523f..d36042551a 100644--- a/saleor/warehouse/migrations/0024_rewrite_order_line_relations.py+++ b/saleor/warehouse/migrations/0024_rewrite_order_line_relations.py@@ -1,7 +1,7 @@# Generated by Django 3.2.12 on 2022-04-13 07:33-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/warehouse/migrations/0027_alter_reservation_models_checkout_line.py b/saleor/warehouse/migrations/0027_alter_reservation_models_checkout_line.pyindex 493a73a191..6712a5ec48 100644--- a/saleor/warehouse/migrations/0027_alter_reservation_models_checkout_line.py+++ b/saleor/warehouse/migrations/0027_alter_reservation_models_checkout_line.py@@ -1,7 +1,7 @@# Generated by Django 3.2.13 on 2022-04-29 09:46-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/warehouse/migrations/0028_rewrite_checkouline_relations.py b/saleor/warehouse/migrations/0028_rewrite_checkouline_relations.pyindex bbb5fecc64..9e46a8e68f 100644--- a/saleor/warehouse/migrations/0028_rewrite_checkouline_relations.py+++ b/saleor/warehouse/migrations/0028_rewrite_checkouline_relations.py@@ -1,7 +1,7 @@# Generated by Django 3.2.13 on 2022-04-29 09:47-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/warehouse/migrations/0031_create_default_warehouse.py b/saleor/warehouse/migrations/0031_create_default_warehouse.pyindex b71ca93615..285395ec92 100644--- a/saleor/warehouse/migrations/0031_create_default_warehouse.py+++ b/saleor/warehouse/migrations/0031_create_default_warehouse.py@@ -1,5 +1,5 @@-from django.db import migrationsfrom django.conf import settings+from django.db import migrationsdef create_default_warehouse(apps, schema_editor):diff --git a/saleor/warehouse/migrations/0032_alter_channel_warehouse.py b/saleor/warehouse/migrations/0032_alter_channel_warehouse.pyindex 4ded20b494..42f039b21d 100644--- a/saleor/warehouse/migrations/0032_alter_channel_warehouse.py+++ b/saleor/warehouse/migrations/0032_alter_channel_warehouse.py@@ -1,7 +1,7 @@# Generated by Django 3.2.14 on 2022-08-19 07:36-from django.db import migrations, modelsimport django.db.models.deletion+from django.db import migrations, modelsclass Migration(migrations.Migration):diff --git a/saleor/warehouse/tests/test_preorder_complete.py b/saleor/warehouse/tests/test_preorder_complete.pyindex 0a88066812..197df6aecf 100644--- a/saleor/warehouse/tests/test_preorder_complete.py+++ b/saleor/warehouse/tests/test_preorder_complete.py@@ -66,8 +66,7 @@ def test_deactivate_preorder_for_variant_order_without_shipping_method(preorder_variant_global_and_channel_threshold,preorder_allocation,):- """When order has no shiping method set,- use warehouse based on country from address."""+ """When order has no shiping method set, use warehouse based on country from address."""variant = preorder_variant_global_and_channel_thresholdorder = preorder_allocation.order_line.orderassert order.shipping_method is Nonediff --git a/saleor/warehouse/tests/test_stock_management.py b/saleor/warehouse/tests/test_stock_management.pyindex 7dc9fb9b69..84c2efa013 100644--- a/saleor/warehouse/tests/test_stock_management.py+++ b/saleor/warehouse/tests/test_stock_management.py@@ -104,8 +104,12 @@ def test_allocate_stock_many_stocks_the_highest_stock_strategy(def test_allocate_stocks_the_highest_stock_strategy_with_collection_point(order_line, variant_with_many_stocks, channel_USD, warehouse_for_cc):- """Ensure that when the collection point is set as delivery method,- the stock will be allocate in this warehouse."""+ """Test that collection points take precedence during stock allocation.++ Ensure that when the collection point is set as delivery method,+ the stock will be allocated in this warehouse even if strategy is set+ to follow the highest stock quantity.+ """variant = variant_with_many_stocksquantity = 5@@ -182,8 +186,12 @@ def test_allocate_stock_many_stocks_prioritize_sorting_order_strategy(def test_allocate_stock_prioritize_sorting_order_strategy_with_collection_point(order_line, variant_with_many_stocks, channel_USD, warehouse_for_cc):- """Ensure that when the collection point is set as delivery method,- the stock will be allocate in this warehouse."""+ """Test that collection points take precedence during stock allocation.++ Ensure that when the collection point is set as delivery method,+ the stock will be allocated in this warehouse even if strategy is set+ to follow the warehouse sorting order.+ """# givenchannel_USD.allocation_strategy = AllocationStrategy.PRIORITIZE_SORTING_ORDERchannel_USD.save(update_fields=["allocation_strategy"])@@ -774,8 +782,11 @@ def test_decrease_stock_multiple_lines(allocations):def test_decrease_stock_multiple_lines_deallocate_stock_raises_error(order_with_lines):- """Ensure that when some of the lines raise an error during the deallocation- quantity allocated value for all allocation will be updated."""+ """Test that stock deallocations are immune to errors.++ Ensure that when some of the lines raise an error during the deallocation+ quantity allocated value for all allocation will be updated.+ """# givenorder_line_1 = order_with_lines.lines.first()diff --git a/saleor/webhook/migrations/0009_webhook_custom_headers.py b/saleor/webhook/migrations/0009_webhook_custom_headers.pyindex 0c377b7a98..deb456b4ac 100644--- a/saleor/webhook/migrations/0009_webhook_custom_headers.py+++ b/saleor/webhook/migrations/0009_webhook_custom_headers.py@@ -1,6 +1,7 @@# Generated by Django 3.2.17 on 2023-02-09 11:28from django.db import migrations, models+import saleor.core.utils.json_serializerimport saleor.webhook.validatorsdiff --git a/saleor/webhook/tests/test_webhook_payloads.py b/saleor/webhook/tests/test_webhook_payloads.pyindex fcc88454a1..a87931edde 100644--- a/saleor/webhook/tests/test_webhook_payloads.py+++ b/saleor/webhook/tests/test_webhook_payloads.py@@ -380,8 +380,11 @@ def test_generate_order_payload_no_user_email_but_user_set(fulfilled_order,customer_user,):- """Ensure that the assigned user's email is returned in `user_email` payload field- when the user_email order value is empty."""+ """Test that user email is always set.++ Ensure that the assigned user's email is returned in `user_email` payload field+ when the user_email order value is empty.+ """# givenfulfillment_lines = '"fulfillment_lines"'mocked_fulfillment_lines.return_value = fulfillment_linesdiff --git a/setup.cfg b/setup.cfgindex 39e35ac7a4..53716fd7b9 100644--- a/setup.cfg+++ b/setup.cfg@@ -38,15 +38,6 @@ ignore = H101,H238,H301,H306,W503max-complexity = 31max-line-length = 88-[pep8]-exclude =- .*/,- __pycache__/,- node_modules/,- */migrations/-ignore = E203,H101,H238,H301,H306,W503-max-line-length = 88-[pydocstyle]ignore = D100, D101, D102, D103, D104, D105, D106, D107, D203, D213, D407, D202inherit = false