Ticket #24315: 24315-test.diff

File 24315-test.diff, 1.6 KB (added by Tim Graham, 9 years ago)
  • tests/auth_tests/test_views.py

    diff --git a/tests/auth_tests/test_views.py b/tests/auth_tests/test_views.py
    index ec99115..c5a5b58 100644
    a b from django.utils.http import urlquote  
    3030from django.utils.six.moves.urllib.parse import ParseResult, urlparse
    3131from django.utils.translation import LANGUAGE_SESSION_KEY
    3232
     33from .models import UUIDUser
    3334from .settings import AUTH_TEMPLATES
    3435
    3536
    class PasswordResetTest(AuthViewsTestCase):  
    329330        self.assertContains(response, "Hello, .")
    330331
    331332
    332 @override_settings(AUTH_USER_MODEL='auth.CustomUser')
     333@override_settings(AUTH_USER_MODEL='auth.UUIDUser')
    333334class CustomUserPasswordResetTest(AuthViewsTestCase):
    334     fixtures = ['custom_user.json']
    335335
    336336    def _test_confirm_start(self):
    337         # Start by creating the email
     337        u = UUIDUser.objects.create_user(
     338            username='foo',
     339            email='staffmember@example.com',
     340            password='foo',
     341        )
    338342        response = self.client.post('/password_reset/', {'email': 'staffmember@example.com'})
    339343        self.assertEqual(response.status_code, 302)
    340344        self.assertEqual(len(mail.outbox), 1)
    class CustomUserPasswordResetTest(AuthViewsTestCase):  
    351355        # redirect to a 'complete' page:
    352356        self.assertContains(response, "Please enter your new password")
    353357
     358        response = self.client.post(path, {
     359            'new_password1': 'anewpassword',
     360            'new_password2': 'anewpassword',
     361        })
     362        self.assertRedirects(response, '/reset/done/')
     363
    354364
    355365class ChangePasswordTest(AuthViewsTestCase):
    356366
Back to Top