Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Wrap task function
akjanikd6cef2c32d53
diff --git a/saleor/checkout/views/summary.py b/saleor/checkout/views/summary.pyindex 0e450cb09f..c9de6fdfc1 100644--- a/saleor/checkout/views/summary.py+++ b/saleor/checkout/views/summary.py@@ -6,7 +6,7 @@ from django.utils.translation import pgettext, pgettext_lazyfrom ...account.forms import get_address_formfrom ...account.models import Addressfrom ...core.exceptions import InsufficientStock-from ...order.emails import send_order_confirmation+from ...order.utils import order_send_confirmationfrom ..forms import (AnonymousUserBillingForm, BillingAddressesForm,BillingWithoutShippingAddressForm, NoteForm)@@ -28,7 +28,7 @@ def create_order(checkout):order.history.create(user=user, content=pgettext_lazy('Order status history entry', 'Order was placed'))- send_order_confirmation.delay(order.pk)+ order_send_confirmation(order.pk)return order, redirect('order:payment', token=order.token)diff --git a/saleor/order/signals.py b/saleor/order/signals.pyindex 7926c58785..e0439e5eea 100644--- a/saleor/order/signals.py+++ b/saleor/order/signals.py@@ -3,7 +3,7 @@ import loggingfrom django.utils.translation import pgettext_lazyfrom ..core import analytics-from .emails import send_order_confirmation+from .utils import order_send_confirmationlogger = logging.getLogger(__name__)@@ -15,7 +15,7 @@ def order_status_change(sender, instance, **kwargs):order.history.create(content=pgettext_lazy('Order status history entry', 'Order fully paid'))- send_order_confirmation.delay(order.pk)+ order_send_confirmation(order.pk)try:analytics.report_order(order.tracking_client_id, order)except Exception:diff --git a/saleor/order/utils.py b/saleor/order/utils.pyindex 0d11a6ef39..cb60cf3dcd 100644--- a/saleor/order/utils.py+++ b/saleor/order/utils.py@@ -210,3 +210,8 @@ def move_order_line_to_group(line, target_group, quantity):target_line.save()line.quantity -= quantityremove_empty_groups(line)+++def order_send_confirmation(order_pk):+ from .emails import send_order_confirmation+ send_order_confirmation.delay(order_pk)diff --git a/tests/test_checkout_integration.py b/tests/test_checkout_integration.pyindex d6678e5fe9..4e31864751 100644--- a/tests/test_checkout_integration.py+++ b/tests/test_checkout_integration.py@@ -1,3 +1,5 @@+from unittest.mock import patch+from django.urls import reversefrom payments import FraudStatus, PaymentStatus@@ -6,7 +8,9 @@ from saleor.account.models import Userfrom .utils import get_redirect_location-def test_checkout_flow(request_cart_with_item, client, shipping_method):+@patch('saleor.checkout.views.summary.order_send_confirmation')+def test_checkout_flow(+ mock_send_confirmation, request_cart_with_item, client, shipping_method):# Enter checkoutcheckout_index = client.get(reverse('checkout:index'), follow=True)# Checkout index redirects directly to shipping address step@@ -65,6 +69,7 @@ def test_checkout_flow(request_cart_with_item, client, shipping_method):order_password = reverse('order:checkout-success', kwargs={'token': order.token})assert get_redirect_location(payment_response) == order_password+ assert mock_send_confirmation.called_once_with(order.pk)def test_checkout_flow_authenticated_user(