Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix typo
fowczarekd3fc0fc2323f
diff --git a/saleor/checkout/utils.py b/saleor/checkout/utils.pyindex fe16f2618f..e0b5502071 100644--- a/saleor/checkout/utils.py+++ b/saleor/checkout/utils.py@@ -35,11 +35,11 @@ from ..core.utils.promo_code import (from ..discount import VoucherTypefrom ..discount.models import NotApplicable, Voucherfrom ..discount.utils import (- add_voucher_usege_by_customer,+ add_voucher_usage_by_customer,decrease_voucher_usage,get_products_voucher_discount,increase_voucher_usage,- remove_voucher_usege_by_customer,+ remove_voucher_usage_by_customer,validate_voucher_for_checkout,)from ..giftcard.utils import (@@ -992,7 +992,7 @@ def _get_voucher_data_for_order(checkout):increase_voucher_usage(voucher)if voucher.apply_once_per_customer:- add_voucher_usege_by_customer(voucher, checkout.get_customer_email())+ add_voucher_usage_by_customer(voucher, checkout.get_customer_email())return {"voucher": voucher,"discount_amount": checkout.discount_amount,@@ -1137,7 +1137,7 @@ def abort_order_data(order_data: dict):voucher = order_data["voucher"]decrease_voucher_usage(voucher)if "user_email" in order_data:- remove_voucher_usege_by_customer(voucher, order_data["user_email"])+ remove_voucher_usage_by_customer(voucher, order_data["user_email"])@transaction.atomicdiff --git a/saleor/discount/utils.py b/saleor/discount/utils.pyindex d7b156c1ef..059c519779 100644--- a/saleor/discount/utils.py+++ b/saleor/discount/utils.py@@ -23,7 +23,7 @@ def decrease_voucher_usage(voucher):voucher.save(update_fields=["used"])-def add_voucher_usege_by_customer(voucher, customer_email):+def add_voucher_usage_by_customer(voucher, customer_email):voucher_customer = VoucherCustomer.objects.filter(voucher=voucher, customer_email=customer_email)@@ -37,7 +37,7 @@ def add_voucher_usege_by_customer(voucher, customer_email):VoucherCustomer.objects.create(voucher=voucher, customer_email=customer_email)-def remove_voucher_usege_by_customer(voucher, customer_email):+def remove_voucher_usage_by_customer(voucher, customer_email):voucher_customer = VoucherCustomer.objects.filter(voucher=voucher, customer_email=customer_email)diff --git a/tests/test_discounts.py b/tests/test_discounts.pyindex cc86397bcb..e570307c33 100644--- a/tests/test_discounts.py+++ b/tests/test_discounts.py@@ -8,11 +8,11 @@ from saleor.checkout.utils import get_voucher_discount_for_checkoutfrom saleor.discount import DiscountInfo, DiscountValueType, VoucherTypefrom saleor.discount.models import NotApplicable, Sale, Voucher, VoucherCustomerfrom saleor.discount.utils import (- add_voucher_usege_by_customer,+ add_voucher_usage_by_customer,decrease_voucher_usage,get_product_discount_on_sale,increase_voucher_usage,- remove_voucher_usege_by_customer,+ remove_voucher_usage_by_customer,validate_voucher,)from saleor.product.models import Product, ProductVariant@@ -188,32 +188,32 @@ def test_decrease_voucher_usage():assert voucher.used == 9-def test_add_voucher_usege_by_customer(voucher, customer_user):- voucherCustomerCount = VoucherCustomer.objects.all().count()- add_voucher_usege_by_customer(voucher, customer_user.email)- assert VoucherCustomer.objects.all().count() == voucherCustomerCount + 1+def test_add_voucher_usage_by_customer(voucher, customer_user):+ voucher_customer_count = VoucherCustomer.objects.all().count()+ add_voucher_usage_by_customer(voucher, customer_user.email)+ assert VoucherCustomer.objects.all().count() == voucher_customer_count + 1voucherCustomer = VoucherCustomer.objects.first()assert voucherCustomer.voucher == voucherassert voucherCustomer.customer_email == customer_user.email-def test_add_voucher_usege_by_customer_raise_not_applicable(voucher_customer):+def test_add_voucher_usage_by_customer_raise_not_applicable(voucher_customer):voucher = voucher_customer.vouchercustomer_email = voucher_customer.customer_emailwith pytest.raises(NotApplicable):- add_voucher_usege_by_customer(voucher, customer_email)+ add_voucher_usage_by_customer(voucher, customer_email)-def test_remove_voucher_usege_by_customer(voucher_customer):- voucherCustomerCount = VoucherCustomer.objects.all().count()+def test_remove_voucher_usage_by_customer(voucher_customer):+ voucher_customer_count = VoucherCustomer.objects.all().count()voucher = voucher_customer.vouchercustomer_email = voucher_customer.customer_email- remove_voucher_usege_by_customer(voucher, customer_email)- assert VoucherCustomer.objects.all().count() == voucherCustomerCount - 1+ remove_voucher_usage_by_customer(voucher, customer_email)+ assert VoucherCustomer.objects.all().count() == voucher_customer_count - 1-def test_remove_voucher_usege_by_customer_not_exists(voucher):- remove_voucher_usege_by_customer(voucher, "[email protected]")+def test_remove_voucher_usage_by_customer_not_exists(voucher):+ remove_voucher_usage_by_customer(voucher, "[email protected]")@pytest.mark.parametrize(diff --git a/tests/test_order.py b/tests/test_order.pyindex 244cc81b7b..2d983059b5 100644--- a/tests/test_order.py+++ b/tests/test_order.py@@ -711,10 +711,12 @@ def test_get_voucher_discount_for_order_voucher_validation():order_with_lines.voucher = voucherorder_with_lines.save()- validate_voucher_in_order(order_with_lines)subtotal = order_with_lines.get_subtotal()quantity = order_with_lines.get_total_quantity()customer_email = order_with_lines.get_customer_email()++ validate_voucher_in_order(order_with_lines)+mock_validate_voucher.assert_called_once_with(voucher, subtotal.gross, quantity, customer_email)