diff options
| author | Alexander Gaevsky <sasha@sasha0.ru> | 2016-02-05 21:03:06 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-03-23 09:01:52 -0400 |
| commit | 107165c4b04f4e5a830a60b6c66b2e5d8fb1d242 (patch) | |
| tree | 2fdb315783b985925bf73a1624d62e2df5f2aba7 /tests/test_client | |
| parent | e0a3d937309a82b8beea8f41b17d8b6298da2a86 (diff) | |
Fixed #24987 -- Allowed inactive users to login with the test client.
Diffstat (limited to 'tests/test_client')
| -rw-r--r-- | tests/test_client/tests.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/test_client/tests.py b/tests/test_client/tests.py index 2ffc1d6896..6a6b5d31a2 100644 --- a/tests/test_client/tests.py +++ b/tests/test_client/tests.py @@ -432,10 +432,14 @@ class ClientTest(TestCase): self.assertFalse(login) def test_view_with_inactive_login(self): - "Request a page that is protected with @login, but use an inactive login" + """ + An inactive user may login if the authenticate backend allows it. + """ + credentials = {'username': 'inactive', 'password': 'password'} + self.assertFalse(self.client.login(**credentials)) - login = self.client.login(username='inactive', password='password') - self.assertFalse(login) + with self.settings(AUTHENTICATION_BACKENDS=['django.contrib.auth.backends.AllowAllUsersModelBackend']): + self.assertTrue(self.client.login(**credentials)) @override_settings( AUTHENTICATION_BACKENDS=[ |
