summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
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)