Skip to content

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

Update test for '_send_set_password_email'

IKarbowiak9b56baa4bd54
diff --git a/tests/test_emails.py b/tests/test_emails.py
index b2ec25bd14..51e542e765 100644
--- a/tests/test_emails.py
+++ b/tests/test_emails.py
@@ -8,7 +8,7 @@ from django.templatetags.static import static
from django.urls import reverse
from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_encode
-from templated_email import get_connection, send_templated_mail
+from templated_email import get_connection
import saleor.account.emails as account_emails
import saleor.order.emails as emails
@@ -229,26 +229,20 @@ def test_email_with_email_not_configured_raises_error(settings, site_settings):
def test_send_set_password_email(staff_user, site_settings):
- site = site_settings.site
uid = urlsafe_base64_encode(force_bytes(staff_user.pk))
token = default_token_generator.make_token(staff_user)
- logo_url = build_absolute_uri(static("images/logo-light.svg"))
password_set_url = build_absolute_uri(
reverse(
"account:reset-password-confirm", kwargs={"token": token, "uidb64": uid}
)
)
- ctx = {
- "logo_url": logo_url,
- "password_set_url": password_set_url,
- "site_name": site.name,
- }
- send_templated_mail(
- template_name="dashboard/staff/set_password",
- from_email=site_settings.default_from_email,
- recipient_list=[staff_user.email],
- context=ctx,
+ template_name = "dashboard/staff/set_password"
+ recipient_email = staff_user.email
+
+ account_emails._send_set_password_email(
+ recipient_email, password_set_url, template_name
)
+
assert len(mail.outbox) == 1
generated_link = reverse(
"account:reset-password-confirm", kwargs={"uidb64": uid, "token": token}