Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix tests in dashboard/test_discounts
Maciej Korycinski24853334a9e3
diff --git a/tests/dashboard/test_discounts.py b/tests/dashboard/test_discounts.pyindex e1db457d3b..2f226da31d 100644--- a/tests/dashboard/test_discounts.py+++ b/tests/dashboard/test_discounts.py@@ -5,7 +5,7 @@ from unittest.mock import Mockimport pytestfrom django.urls import reverse-from prices import Money, TaxedMoney+from prices import Moneyfrom saleor.dashboard.order.utils import get_voucher_discount_for_orderfrom saleor.discount import DiscountValueType, VoucherType@@ -103,14 +103,14 @@ def test_view_sale_add_requires_product_category_or_collection(@pytest.mark.parametrize(- "total, discount_value, discount_type, min_amount_spent, expected_value",+ "subtotal, discount_value, discount_type, min_amount_spent, expected_value",[("100", 10, DiscountValueType.FIXED, None, 10),("100.05", 10, DiscountValueType.PERCENTAGE, 100, 10),],)def test_value_voucher_order_discount(- settings, total, discount_value, discount_type, min_amount_spent, expected_value+ subtotal, discount_value, discount_type, min_amount_spent, expected_value):voucher = Voucher(code="unique",@@ -121,7 +121,7 @@ def test_value_voucher_order_discount(if min_amount_spent is not Noneelse None,)- subtotal = TaxedMoney(net=Money(total, "USD"), gross=Money(total, "USD"))+ subtotal = Money(subtotal, "USD")order = Mock(get_subtotal=Mock(return_value=subtotal), voucher=voucher)discount = get_voucher_discount_for_order(order)assert discount == Money(expected_value, "USD")@@ -141,10 +141,8 @@ def test_shipping_voucher_order_discount(discount_value=discount_value,min_amount_spent=None,)- subtotal = TaxedMoney(net=Money(100, "USD"), gross=Money(100, "USD"))- shipping_total = TaxedMoney(- net=Money(shipping_cost, "USD"), gross=Money(shipping_cost, "USD")- )+ subtotal = Money(100, "USD")+ shipping_total = Money(shipping_cost, "USD")order = Mock(get_subtotal=Mock(return_value=subtotal),shipping_price=shipping_total,@@ -162,7 +160,7 @@ def test_shipping_voucher_checkout_discount_not_applicable_returns_zero():discount_value=10,min_amount_spent=Money(20, "USD"),)- price = TaxedMoney(net=Money(10, "USD"), gross=Money(10, "USD"))+ price = Money(10, "USD")order = Mock(get_subtotal=Mock(return_value=price), shipping_price=price, voucher=voucher)