Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix tests
Pacu2af8a236ce7a1
diff --git a/saleor/order/__init__.py b/saleor/order/__init__.pyindex 40bde7ec5b..ebbed6b769 100644--- a/saleor/order/__init__.py+++ b/saleor/order/__init__.py@@ -112,12 +112,11 @@ def get_money_from_params(amount):Can be safely removed after migrating to Dashboard 2.0"""- money_amount = amount- money_currency = settings.DEFAULT_CURRENCY+ if isinstance(amount, Money):+ return amountif isinstance(amount, dict):- money_amount = amount['amount']- money_currency = amount['currency']- return Money(amount=money_amount, currency=money_currency)+ return Money(amount=amount['amount'], currency=amount['currency'])+ return Money(amount, settings.DEFAULT_CURRENCY)def display_order_event(order_event):diff --git a/tests/dashboard/test_order.py b/tests/dashboard/test_order.pyindex e372fc6079..1843611c17 100644--- a/tests/dashboard/test_order.py+++ b/tests/dashboard/test_order.py@@ -1,11 +1,12 @@import jsonimport pytest-from django.conf import settingsfrom django.urls import reversefrom payments import PaymentStatusfrom prices import Money+from tests.utils import get_form_errors, get_redirect_location+from saleor.checkout import AddressTypefrom saleor.core.utils.taxes import ZERO_MONEY, ZERO_TAXED_MONEYfrom saleor.dashboard.order.forms import ChangeQuantityForm@@ -15,11 +16,10 @@ from saleor.dashboard.order.utils import (from saleor.discount.utils import increase_voucher_usagefrom saleor.order import (FulfillmentStatus, OrderEvents, OrderEventsEmails, OrderStatus)-from saleor.order.models import Order, OrderLine, OrderEvent+from saleor.order.models import Order, OrderEvent, OrderLinefrom saleor.order.utils import add_variant_to_order, change_order_line_quantityfrom saleor.product.models import ProductVariantfrom saleor.shipping.models import ShippingZone-from tests.utils import get_form_errors, get_redirect_locationdef test_ajax_order_shipping_methods_list(@@ -1232,7 +1232,7 @@ def test_order_event_display(admin_user, type, order):'quantity': 12,'email_type': OrderEventsEmails.PAYMENT.value,'email': '[email protected]',- 'amount': json.dumps(Money(80, 'USD')),+ 'amount': {'_type': 'Money', 'amount': '10.00', 'currency': 'USD'},'composed_id': 12,'tracking_number': '5421AB','oversold_items': ['Blue Shirt', 'Red Shirt']}