summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorshanghui <shangdahao@gmail.com>2017-11-08 16:32:49 +0800
committerTim Graham <timograham@gmail.com>2017-11-08 09:52:27 -0500
commit308f64462421b09b21ef0dcd9cc3654cc25bceba (patch)
tree65cbf0aacf7a2598ec9e5a31117f8bac10ce2fa6 /tests
parentd9b457d906a55a7473f5727fe24cd4b0141f8b5f (diff)
[1.11.x] Fixed #28645 -- Reallowed AuthenticationForm to raise the inactive user error when using ModelBackend.
Regression in e0a3d937309a82b8beea8f41b17d8b6298da2a86. Thanks Guilherme Junqueira for the report and Tim Graham for the review. Backport of 359370a8b8ca0efe99b1d4630b291ec060b69225 from master
Diffstat (limited to 'tests')
-rw-r--r--tests/auth_tests/test_forms.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py
index 4bfc3d11e7..b82bbc58f4 100644
--- a/tests/auth_tests/test_forms.py
+++ b/tests/auth_tests/test_forms.py
@@ -249,9 +249,6 @@ class UserCreationFormTest(TestDataMixin, TestCase):
)
-# To verify that the login form rejects inactive users, use an authentication
-# backend that allows them.
-@override_settings(AUTHENTICATION_BACKENDS=['django.contrib.auth.backends.AllowAllUsersModelBackend'])
class AuthenticationFormTest(TestDataMixin, TestCase):
def test_invalid_username(self):
@@ -310,6 +307,8 @@ class AuthenticationFormTest(TestDataMixin, TestCase):
self.assertFalse(form.is_valid())
self.assertEqual(form.non_field_errors(), [force_text(form.error_messages['inactive'])])
+ # Use an authentication backend that allows inactive users.
+ @override_settings(AUTHENTICATION_BACKENDS=['django.contrib.auth.backends.AllowAllUsersModelBackend'])
def test_custom_login_allowed_policy(self):
# The user is inactive, but our custom form policy allows them to log in.
data = {