summaryrefslogtreecommitdiff
path: root/tests/auth_tests
diff options
context:
space:
mode:
authorsujayskumar <sujay.skumar141295@gmail.com>2015-06-18 18:19:35 +0530
committerTim Graham <timograham@gmail.com>2015-09-18 18:56:04 -0400
commitd8d853378b3ff75c03d8bd91ea026d2b8c642b0f (patch)
tree2940f0b5eff6cef6848da60ad7c22acf63f43447 /tests/auth_tests
parentaac2a2d2ae2486342058db0c72ed7ba2c7c8eb1e (diff)
Fixed #24944 -- Added extra_email_context parameter to password_reset() view.
Diffstat (limited to 'tests/auth_tests')
-rw-r--r--tests/auth_tests/templates/registration/password_reset_email.html1
-rw-r--r--tests/auth_tests/test_views.py12
-rw-r--r--tests/auth_tests/urls.py2
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,