Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Remove redundant function

akjanik8fca8d151bdb
diff --git a/saleor/checkout/views/summary.py b/saleor/checkout/views/summary.py
index 1d3fc26012..0e450cb09f 100644
--- a/saleor/checkout/views/summary.py
+++ b/saleor/checkout/views/summary.py
@@ -6,7 +6,7 @@ from django.utils.translation import pgettext, pgettext_lazy
from ...account.forms import get_address_form
from ...account.models import Address
from ...core.exceptions import InsufficientStock
-from ...order.emails import order_send_confirmation
+from ...order.emails import send_order_confirmation
from ..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'))
- order_send_confirmation(order.pk)
+ send_order_confirmation.delay(order.pk)
return order, redirect('order:payment', token=order.token)
diff --git a/saleor/order/emails.py b/saleor/order/emails.py
index f177588311..bc6bf06139 100644
--- a/saleor/order/emails.py
+++ b/saleor/order/emails.py
@@ -54,7 +54,3 @@ 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.py
index 43eac7626c..7926c58785 100644
--- a/saleor/order/signals.py
+++ b/saleor/order/signals.py
@@ -3,7 +3,7 @@ import logging
from django.utils.translation import pgettext_lazy
from ..core import analytics
-from .emails import order_send_confirmation
+from .emails import send_order_confirmation
logger = 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'))
- order_send_confirmation(order.pk)
+ send_order_confirmation.delay(order.pk)
try:
analytics.report_order(order.tracking_client_id, order)
except Exception:
diff --git a/saleor/order/utils.py b/saleor/order/utils.py
index 81e4add29b..0d11a6ef39 100644
--- a/saleor/order/utils.py
+++ b/saleor/order/utils.py
@@ -210,4 +210,3 @@ def move_order_line_to_group(line, target_group, quantity):
target_line.save()
line.quantity -= quantity
remove_empty_groups(line)
-
diff --git a/tests/test_checkout_integration.py b/tests/test_checkout_integration.py
index 8e9975a97f..f1d4316be4 100644
--- a/tests/test_checkout_integration.py
+++ b/tests/test_checkout_integration.py
@@ -8,7 +8,7 @@ from saleor.account.models import User
from .utils import get_redirect_location
-@patch('saleor.checkout.views.summary.order_send_confirmation')
+@patch('saleor.checkout.views.summary.send_order_confirmation')
def test_checkout_flow(
mock_send_confirmation, request_cart_with_item, client, shipping_method):
# Enter checkout
@@ -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
- mock_send_confirmation.assert_called_once_with(order.pk)
+ mock_send_confirmation.delay.assert_called_once_with(order.pk)
def test_checkout_flow_authenticated_user(
diff --git a/tests/test_order.py b/tests/test_order.py
index 9000a2d895..2a6287b78c 100644
--- a/tests/test_order.py
+++ b/tests/test_order.py
@@ -6,7 +6,7 @@ from prices import Price
from tests.utils import get_redirect_location
from saleor.order import OrderStatus, models
-from saleor.order.emails import collect_data_for_email, order_send_confirmation
+from saleor.order.emails import collect_data_for_email
from saleor.order.forms import OrderNoteForm
from saleor.order.utils import add_variant_to_delivery_group
@@ -189,10 +189,3 @@ 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)