summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAbeer Upadhyay <ab.esquarer@gmail.com>2018-03-25 13:39:32 +0530
committerTim Graham <timograham@gmail.com>2018-03-28 10:10:18 -0400
commit1bf4646f9133f26547a0dccf2f8a4526d85f2ab3 (patch)
treeb0daff8bfb53294549d1270d73318d0bf4e318ca /tests
parent76ae1e9a94cbfddbbf115ad96f26901ba5c02d44 (diff)
Fixed #29258 -- Added type checking for login()'s backend argument.
Diffstat (limited to 'tests')
-rw-r--r--tests/auth_tests/test_auth_backends.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auth_tests/test_auth_backends.py b/tests/auth_tests/test_auth_backends.py
index 1a1950e989..25a910cdf1 100644
--- a/tests/auth_tests/test_auth_backends.py
+++ b/tests/auth_tests/test_auth_backends.py
@@ -695,6 +695,15 @@ class SelectingBackendTests(TestCase):
with self.assertRaisesMessage(ValueError, expected_message):
self.client._login(user)
+ def test_non_string_backend(self):
+ user = User.objects.create_user(self.username, 'email', self.password)
+ expected_message = (
+ 'backend must be a dotted import path string (got '
+ '<class \'django.contrib.auth.backends.ModelBackend\'>).'
+ )
+ with self.assertRaisesMessage(TypeError, expected_message):
+ self.client._login(user, backend=ModelBackend)
+
@override_settings(AUTHENTICATION_BACKENDS=[backend, other_backend])
def test_backend_path_login_with_explicit_backends(self):
user = User.objects.create_user(self.username, 'email', self.password)