Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add tests
akjanik244b3df9e783
diff --git a/saleor/checkout/views/summary.py b/saleor/checkout/views/summary.pyindex c9de6fdfc1..1d3fc26012 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.utils import order_send_confirmation+from ...order.emails import order_send_confirmationfrom ..forms import (AnonymousUserBillingForm, BillingAddressesForm,BillingWithoutShippingAddressForm, NoteForm)diff --git a/saleor/order/emails.py b/saleor/order/emails.pyindex bc6bf06139..f177588311 100644--- a/saleor/order/emails.py+++ b/saleor/order/emails.py@@ -54,3 +54,7 @@ def send_payment_confirmation(order_pk):def send_note_confirmation(order_pk):email_data = collect_data_for_email(order_pk, CONFIRM_NOTE_TEMPLATE)_send_confirmation(**email_data)+++def order_send_confirmation(order_pk):+ send_order_confirmation.delay(order_pk)diff --git a/saleor/order/signals.py b/saleor/order/signals.pyindex e0439e5eea..43eac7626c 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 .utils import order_send_confirmation+from .emails import order_send_confirmationlogger = logging.getLogger(__name__)diff --git a/saleor/order/utils.py b/saleor/order/utils.pyindex cb60cf3dcd..81e4add29b 100644--- a/saleor/order/utils.py+++ b/saleor/order/utils.py@@ -211,7 +211,3 @@ def move_order_line_to_group(line, target_group, quantity):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 4e31864751..8e9975a97f 100644--- a/tests/test_checkout_integration.py+++ b/tests/test_checkout_integration.py@@ -69,7 +69,7 @@ def test_checkout_flow(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)+ mock_send_confirmation.assert_called_once_with(order.pk)def test_checkout_flow_authenticated_user(diff --git a/tests/test_order.py b/tests/test_order.pyindex c2f779b79d..9000a2d895 100644--- a/tests/test_order.py+++ b/tests/test_order.py@@ -1,12 +1,12 @@from decimal import Decimal-from unittest.mock import Mock+from unittest.mock import Mock, patchfrom django.urls import reversefrom prices import Pricefrom tests.utils import get_redirect_locationfrom saleor.order import OrderStatus, models-from saleor.order.emails import collect_data_for_email+from saleor.order.emails import collect_data_for_email, order_send_confirmationfrom saleor.order.forms import OrderNoteFormfrom saleor.order.utils import add_variant_to_delivery_group@@ -189,3 +189,10 @@ def test_collect_data_for_email(order):order_url = reverse('order:details', kwargs={'token': order.token})assert order_url in email_data['url']assert email_data['email'] == order.user_email+++@patch('saleor.order.emails.send_order_confirmation')+def test_order_send_confirmation(mocked_task_function, order):+ pk = order.pk+ order_send_confirmation(pk)+ mocked_task_function.delay.assert_called_with(pk)