diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/auth_tests/templates/registration/password_reset_email.html | 1 | ||||
| -rw-r--r-- | tests/auth_tests/test_views.py | 12 | ||||
| -rw-r--r-- | tests/auth_tests/urls.py | 2 |
3 files changed, 15 insertions, 0 deletions
diff --git a/tests/auth_tests/templates/registration/password_reset_email.html b/tests/auth_tests/templates/registration/password_reset_email.html index baac2fc2dd..07043aa92e 100644 --- a/tests/auth_tests/templates/registration/password_reset_email.html +++ b/tests/auth_tests/templates/registration/password_reset_email.html @@ -1 +1,2 @@ {{ protocol }}://{{ domain }}/reset/{{ uid }}/{{ token }}/ +Email email context: "{{ greeting }}" diff --git a/tests/auth_tests/test_views.py b/tests/auth_tests/test_views.py index 7b497ac458..723b20a812 100644 --- a/tests/auth_tests/test_views.py +++ b/tests/auth_tests/test_views.py @@ -174,6 +174,18 @@ class PasswordResetTest(AuthViewsTestCase): # default functionality is 100% the same self.assertFalse(mail.outbox[0].message().is_multipart()) + def test_extra_email_context(self): + """ + extra_email_context should be available in the email template context. + """ + response = self.client.post( + '/password_reset_extra_email_context/', + {'email': 'staffmember@example.com'}, + ) + self.assertEqual(response.status_code, 302) + self.assertEqual(len(mail.outbox), 1) + self.assertIn('Email email context: "Hello!"', mail.outbox[0].body) + def test_html_mail_template(self): """ A multipart email with text/plain and text/html is sent diff --git a/tests/auth_tests/urls.py b/tests/auth_tests/urls.py index 2851b451e1..0c43123f87 100644 --- a/tests/auth_tests/urls.py +++ b/tests/auth_tests/urls.py @@ -71,6 +71,8 @@ urlpatterns = auth_urlpatterns + [ url(r'^logout/next_page/named/$', views.logout, dict(next_page='password_reset')), url(r'^remote_user/$', remote_user_auth_view), url(r'^password_reset_from_email/$', views.password_reset, dict(from_email='staffmember@example.com')), + url(r'^password_reset_extra_email_context/$', views.password_reset, + dict(extra_email_context=dict(greeting='Hello!'))), url(r'^password_reset/custom_redirect/$', views.password_reset, dict(post_reset_redirect='/custom/')), url(r'^password_reset/custom_redirect/named/$', views.password_reset, dict(post_reset_redirect='password_reset')), url(r'^password_reset/html_email_template/$', views.password_reset, |
