forked from saleor/saleor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -245,6 +245,46 @@ def test_send_fulfillment_emails( | |
email_connection.get_email_message(to=recipients, **expected_call_kwargs) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"send_email,template", | ||
[ | ||
( | ||
emails.send_fulfillment_confirmation, | ||
emails.CONFIRM_FULFILLMENT_TEMPLATE, | ||
), # noqa | ||
(emails.send_fulfillment_update, emails.UPDATE_FULFILLMENT_TEMPLATE), | ||
], | ||
) | ||
@mock.patch("saleor.order.emails.send_templated_mail") | ||
def test_send_fulfillment_emails_with_tracking_number_as_url( | ||
mocked_templated_email, template, send_email, fulfilled_order, site_settings | ||
): | ||
fulfillment = fulfilled_order.fulfillments.first() | ||
fulfillment.tracking_number = "https://www.example.com" | ||
fulfillment.save() | ||
assert fulfillment.is_tracking_number_url | ||
send_email(order_pk=fulfilled_order.pk, fulfillment_pk=fulfillment.pk) | ||
email_data = emails.collect_data_for_fullfillment_email( | ||
fulfilled_order.pk, template, fulfillment.pk | ||
) | ||
|
||
recipients = [fulfilled_order.get_customer_email()] | ||
|
||
expected_call_kwargs = { | ||
"context": email_data["context"], | ||
"from_email": site_settings.default_from_email, | ||
"template_name": template, | ||
} | ||
|
||
mocked_templated_email.assert_called_once_with( | ||
recipient_list=recipients, **expected_call_kwargs | ||
) | ||
|
||
# Render the email to ensure there is no error | ||
email_connection = get_connection() | ||
email_connection.get_email_message(to=recipients, **expected_call_kwargs) | ||
|
||
|
||
def test_email_having_display_name_in_settings(customer_user, site_settings, settings): | ||
expected_from_email = "Info <[email protected]>" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters