Skip to content

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

Create new proxy function for email sending via templated_email

Jakub Draganek1a58f40f8400
diff --git a/saleor/order/emails.py b/saleor/order/emails.py
new file mode 100644
index 0000000000..0ab0c6e80a
--- /dev/null
+++ b/saleor/order/emails.py
@@ -0,0 +1,9 @@
+from templated_email import send_templated_mail
+
+
+CONFIRMATION_TEMPLATE = 'foo'
+
+
+def send_confirmation(address):
+ send_templated_mail(from_email=address, recipient_list=[], context={},
+ template_name=CONFIRMATION_TEMPLATE)
diff --git a/tests/test_emails.py b/tests/test_emails.py
new file mode 100644
index 0000000000..c8b0ae407b
--- /dev/null
+++ b/tests/test_emails.py
@@ -0,0 +1,17 @@
+from __future__ import unicode_literals
+
+import saleor.order.emails as emails
+import pytest
+import mock
+
+
+EMAIL_DATA = {'from_email': '[email protected]',
+ 'template_name': emails.CONFIRMATION_TEMPLATE}
+
+
[email protected]('saleor.order.emails.send_templated_mail')
+def test_send_confirmation_using_templated_email(mocked_templated_email):
+ emails.send_confirmation(EMAIL_DATA['from_email'])
+ mocked_templated_email.assert_called_once_with(recipient_list=[],
+ context={},
+ **EMAIL_DATA)