Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix review remarks
fowczarek400c9844c3e5
diff --git a/saleor/graphql/discount/mutations.py b/saleor/graphql/discount/mutations.pyindex 50969c6582..05de19623a 100644--- a/saleor/graphql/discount/mutations.py+++ b/saleor/graphql/discount/mutations.py@@ -101,7 +101,7 @@ class VoucherInput(graphene.InputObjectType):description="Country codes that can be used with the shipping voucher",)apply_once_per_order = graphene.Boolean(- description="Voucher should be applied to the cheapest item or order"+ description="Voucher should be applied to the cheapest item or entire order")diff --git a/tests/api/test_discount.py b/tests/api/test_discount.pyindex 21f75c006a..6ec6689e4f 100644--- a/tests/api/test_discount.py+++ b/tests/api/test_discount.py@@ -293,8 +293,8 @@ def test_update_voucher(staff_api_client, voucher, permission_manage_discounts):}}"""- # Set discount value type to 'fixed' and change it in mutationapply_once_per_order = not voucher.apply_once_per_order+ # Set discount value type to 'fixed' and change it in mutationvoucher.discount_value_type = DiscountValueType.FIXEDvoucher.save()assert voucher.code != "testcode123"diff --git a/tests/conftest.py b/tests/conftest.pyindex 82825bd840..05a9041bbc 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -1,3 +1,4 @@+import uuidfrom io import BytesIOfrom unittest.mock import MagicMock, Mock@@ -100,7 +101,6 @@ def checkout_with_items(checkout, product_list, product):for prod in product_list:variant = prod.variants.get()add_variant_to_checkout(checkout, variant, 1)- checkout.save()return checkout@@ -519,12 +519,28 @@ def product_list(product_type, category):),])- sku = 0- for product in products:- ProductVariant.objects.create(- product=product, sku=sku, track_inventory=True, quantity=100- )- sku = sku + 1+ ProductVariant.objects.bulk_create(+ [+ ProductVariant(+ product=products[0],+ sku=str(uuid.uuid4()).replace("-", ""),+ track_inventory=True,+ quantity=100,+ ),+ ProductVariant(+ product=products[1],+ sku=str(uuid.uuid4()).replace("-", ""),+ track_inventory=True,+ quantity=100,+ ),+ ProductVariant(+ product=products[2],+ sku=str(uuid.uuid4()).replace("-", ""),+ track_inventory=True,+ quantity=100,+ ),+ ]+ )return productsdiff --git a/tests/test_checkout.py b/tests/test_checkout.pyindex c89586fd46..ee97d1cad3 100644--- a/tests/test_checkout.py+++ b/tests/test_checkout.py@@ -867,14 +867,13 @@ def test_get_discount_for_checkout_apply_once_per_order(apply_once_per_order,discount_amount,):- voucher = Voucher(+ voucher = Voucher.objects.create(code="unique",type=VoucherType.PRODUCT,discount_value_type=discount_type,discount_value=discount_value,apply_once_per_order=apply_once_per_order,)- voucher.save()for product in product_list:voucher.products.add(product)discount = get_voucher_discount_for_checkout(voucher, checkout_with_items)