Refs #19130 -- Added a test for AuthenticationForm.username max_length.
This will be a more useful regression test after refs #27515.
This commit is contained in:
parent
5114669f72
commit
d233391208
|
@ -377,6 +377,18 @@ class AuthenticationFormTest(TestDataMixin, TestCase):
|
||||||
self.assertTrue(form.is_valid())
|
self.assertTrue(form.is_valid())
|
||||||
self.assertEqual(form.non_field_errors(), [])
|
self.assertEqual(form.non_field_errors(), [])
|
||||||
|
|
||||||
|
@override_settings(AUTH_USER_MODEL='auth_tests.IntegerUsernameUser')
|
||||||
|
def test_username_field_max_length_defaults_to_254(self):
|
||||||
|
self.assertIsNone(IntegerUsernameUser._meta.get_field('username').max_length)
|
||||||
|
data = {
|
||||||
|
'username': '0123456',
|
||||||
|
'password': 'password',
|
||||||
|
}
|
||||||
|
IntegerUsernameUser.objects.create_user(**data)
|
||||||
|
form = AuthenticationForm(None, data)
|
||||||
|
self.assertEqual(form.fields['username'].max_length, 254)
|
||||||
|
self.assertEqual(form.errors, {})
|
||||||
|
|
||||||
def test_username_field_label(self):
|
def test_username_field_label(self):
|
||||||
|
|
||||||
class CustomAuthenticationForm(AuthenticationForm):
|
class CustomAuthenticationForm(AuthenticationForm):
|
||||||
|
|
Loading…
Reference in New Issue