diff options
| author | levental <levental@fh-brandenburg.de> | 2016-09-19 14:55:18 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-09-27 11:59:00 -0400 |
| commit | 617e36dc1ede2a311dfd03f18432b31cbfe4c0f7 (patch) | |
| tree | 38fd43fc044ff923321b444c292686798dfb17bd /tests/auth_tests/test_forms.py | |
| parent | f7e91cac689b28fc32ca52cdeac258ec0d58b4fc (diff) | |
Fixed #20705 -- Allowed using PasswordResetForm with user models with an email field not named 'email'.
Diffstat (limited to 'tests/auth_tests/test_forms.py')
| -rw-r--r-- | tests/auth_tests/test_forms.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py index c0e2961424..8d656bd6f9 100644 --- a/tests/auth_tests/test_forms.py +++ b/tests/auth_tests/test_forms.py @@ -26,6 +26,7 @@ from django.utils.translation import ugettext as _ from .models.custom_user import ( CustomUser, CustomUserWithoutIsActiveField, ExtensionUser, ) +from .models.with_custom_email_field import CustomEmailField from .models.with_integer_username import IntegerUsernameUser from .settings import AUTH_TEMPLATES @@ -812,6 +813,17 @@ class PasswordResetFormTest(TestDataMixin, TestCase): message.get_payload(1).get_payload() )) + @override_settings(AUTH_USER_MODEL='auth_tests.CustomEmailField') + def test_custom_email_field(self): + email = 'test@mail.com' + CustomEmailField.objects.create_user('test name', 'test password', email) + form = PasswordResetForm({'email': email}) + self.assertTrue(form.is_valid()) + form.save() + self.assertEqual(form.cleaned_data['email'], email) + self.assertEqual(len(mail.outbox), 1) + self.assertEqual(mail.outbox[0].to, [email]) + class ReadOnlyPasswordHashTest(SimpleTestCase): |
