summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSam Reynolds <sam@smjr.co.uk>2019-09-17 15:21:50 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-09-18 12:04:47 +0200
commite74ca0226a0699ac046d59159e46fddf52ff93b5 (patch)
treefae78b82a7a9ac836ee79fac1c7e8e38863f2772 /tests
parent6c761a25fbd1931a363457b275e2f1f5395814fe (diff)
[3.0.x] Fixed #30776 -- Restored max length validation on AuthenticationForm.UsernameField.
Regression in 5ceaf14686ce626404afb6a5fbd3d8286410bf13. Thanks gopackgo90 for the report and Mariusz Felisiak for tests. Backport of 6c9778a58e4f680db180d4cc9dc5639d2ec1b40c from master
Diffstat (limited to 'tests')
-rw-r--r--tests/auth_tests/test_forms.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py
index 7085dcfa11..40e3050144 100644
--- a/tests/auth_tests/test_forms.py
+++ b/tests/auth_tests/test_forms.py
@@ -423,6 +423,7 @@ class AuthenticationFormTest(TestDataMixin, TestCase):
CustomEmailField.objects.create_user(**data)
form = AuthenticationForm(None, data)
self.assertEqual(form.fields['username'].max_length, 255)
+ self.assertEqual(form.fields['username'].widget.attrs.get('maxlength'), 255)
self.assertEqual(form.errors, {})
@override_settings(AUTH_USER_MODEL='auth_tests.IntegerUsernameUser')
@@ -435,6 +436,7 @@ class AuthenticationFormTest(TestDataMixin, TestCase):
IntegerUsernameUser.objects.create_user(**data)
form = AuthenticationForm(None, data)
self.assertEqual(form.fields['username'].max_length, 254)
+ self.assertEqual(form.fields['username'].widget.attrs.get('maxlength'), 254)
self.assertEqual(form.errors, {})
def test_username_field_label(self):