diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/auth_tests/test_forms.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py index 707d5b87ad..dde639dc01 100644 --- a/tests/auth_tests/test_forms.py +++ b/tests/auth_tests/test_forms.py @@ -22,7 +22,9 @@ from django.utils.encoding import force_text from django.utils.text import capfirst from django.utils.translation import ugettext as _ -from .models.custom_user import CustomUser, ExtensionUser +from .models.custom_user import ( + CustomUser, CustomUserWithoutIsActiveField, ExtensionUser, +) from .models.with_integer_username import IntegerUsernameUser from .settings import AUTH_TEMPLATES @@ -209,6 +211,20 @@ class UserCreationFormTest(TestDataMixin, TestCase): form = CustomUserCreationForm(data) self.assertTrue(form.is_valid()) + def test_custom_form_hidden_username_field(self): + class CustomUserCreationForm(UserCreationForm): + class Meta(UserCreationForm.Meta): + model = CustomUserWithoutIsActiveField + fields = ('email',) # without USERNAME_FIELD + + data = { + 'email': 'testclient@example.com', + 'password1': 'testclient', + 'password2': 'testclient', + } + form = CustomUserCreationForm(data) + self.assertTrue(form.is_valid()) + def test_password_whitespace_not_stripped(self): data = { 'username': 'testuser', |
