From aff61790a326f214f5ea608bac8298c3a8716b1b Mon Sep 17 00:00:00 2001 From: Mattia Procopio Date: Thu, 23 May 2019 14:22:41 +0200 Subject: [PATCH] Refs #24944 -- Added test for overriding domain in email context in PasswordResetView. --- tests/auth_tests/test_views.py | 1 + tests/auth_tests/urls.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/auth_tests/test_views.py b/tests/auth_tests/test_views.py index 0b07b7ebbc..04eaa8574f 100644 --- a/tests/auth_tests/test_views.py +++ b/tests/auth_tests/test_views.py @@ -134,6 +134,7 @@ class PasswordResetTest(AuthViewsTestCase): self.assertEqual(response.status_code, 302) self.assertEqual(len(mail.outbox), 1) self.assertIn('Email email context: "Hello!"', mail.outbox[0].body) + self.assertIn('http://custom.example.com/reset/', mail.outbox[0].body) def test_html_mail_template(self): """ diff --git a/tests/auth_tests/urls.py b/tests/auth_tests/urls.py index f3cfa9f982..c34993ff93 100644 --- a/tests/auth_tests/urls.py +++ b/tests/auth_tests/urls.py @@ -91,7 +91,10 @@ urlpatterns = auth_urlpatterns + [ path('password_reset_from_email/', views.PasswordResetView.as_view(from_email='staffmember@example.com')), path( 'password_reset_extra_email_context/', - views.PasswordResetView.as_view(extra_email_context={'greeting': 'Hello!'})), + views.PasswordResetView.as_view( + extra_email_context={'greeting': 'Hello!', 'domain': 'custom.example.com'}, + ), + ), path( 'password_reset/custom_redirect/', views.PasswordResetView.as_view(success_url='/custom/')),