summaryrefslogtreecommitdiff
path: root/tests/auth_tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-02-13 09:12:30 -0500
committerTim Graham <timograham@gmail.com>2015-02-13 09:57:44 -0500
commit2347f3267fbbfab76930fb6068b0361bff297691 (patch)
tree394e9c2c36d6932b58603e208a9c4ba835286f65 /tests/auth_tests
parent8fc4840289a0538af005619551c3b67f4f9e1399 (diff)
[1.8.x] Fixed #24315 -- Fixed auth.views.password_reset_confirm() with a UUID user.
Backport of 002425fe39f62faafaa32e400f7531809181a1a0 from master
Diffstat (limited to 'tests/auth_tests')
-rw-r--r--tests/auth_tests/test_views.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/auth_tests/test_views.py b/tests/auth_tests/test_views.py
index 8f0bf59fff..8b019139a0 100644
--- a/tests/auth_tests/test_views.py
+++ b/tests/auth_tests/test_views.py
@@ -334,10 +334,11 @@ class PasswordResetTest(AuthViewsTestCase):
@override_settings(AUTH_USER_MODEL='auth.CustomUser')
class CustomUserPasswordResetTest(AuthViewsTestCase):
fixtures = ['custom_user.json']
+ user_email = 'staffmember@example.com'
def _test_confirm_start(self):
# Start by creating the email
- response = self.client.post('/password_reset/', {'email': 'staffmember@example.com'})
+ response = self.client.post('/password_reset/', {'email': self.user_email})
self.assertEqual(response.status_code, 302)
self.assertEqual(len(mail.outbox), 1)
return self._read_signup_email(mail.outbox[0])
@@ -352,6 +353,26 @@ class CustomUserPasswordResetTest(AuthViewsTestCase):
response = self.client.get(path)
# redirect to a 'complete' page:
self.assertContains(response, "Please enter your new password")
+ # then submit a new password
+ response = self.client.post(path, {
+ 'new_password1': 'anewpassword',
+ 'new_password2': 'anewpassword',
+ })
+ self.assertRedirects(response, '/reset/done/')
+
+
+@override_settings(AUTH_USER_MODEL='auth.UUIDUser')
+class UUIDUserPasswordResetTest(CustomUserPasswordResetTest):
+ fixtures = None
+
+ def _test_confirm_start(self):
+ # instead of fixture
+ UUIDUser.objects.create_user(
+ email=self.user_email,
+ username='foo',
+ password='foo',
+ )
+ return super(UUIDUserPasswordResetTest, self)._test_confirm_start()
class ChangePasswordTest(AuthViewsTestCase):