Skip to content

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

Fix updating data for fulfillment email

Anna Siwik3b6e67846237
diff --git a/saleor/order/emails.py b/saleor/order/emails.py
index 025c2f1d4f..2d22c79f4b 100644
--- a/saleor/order/emails.py
+++ b/saleor/order/emails.py
@@ -53,7 +53,7 @@ def collect_data_for_email(order_pk, template):
def collect_data_for_fullfillment_email(order_pk, template, fulfillment_pk):
fulfillment = Fulfillment.objects.get(pk=fulfillment_pk)
email_data = collect_data_for_email(order_pk, template)
- email_data.update({'context': {'fulfillment': fulfillment}})
+ email_data['context'].update({'fulfillment': fulfillment})
return email_data
diff --git a/tests/test_emails.py b/tests/test_emails.py
index 2dad948455..d242948b64 100644
--- a/tests/test_emails.py
+++ b/tests/test_emails.py
@@ -36,10 +36,14 @@ def test_collect_data_for_order_confirmation_email(order):
def test_collect_data_for_fullfillment_email(fulfilled_order):
template = emails.CONFIRM_FULFILLMENT_TEMPLATE
fulfillment = fulfilled_order.fulfillments.first()
- email_data = emails.collect_data_for_fullfillment_email(
+ fulfillment_data = emails.collect_data_for_fullfillment_email(
fulfilled_order.pk, template, fulfillment.pk)
- email_context = email_data['context']
+ email_context = fulfillment_data['context']
assert email_context['fulfillment'] == fulfillment
+ email_data = emails.collect_data_for_email(fulfilled_order.pk, template)
+ assert all([
+ key in email_context
+ for key, item in email_data['context'].items()])
def test_collect_data_for_email(order):