summaryrefslogtreecommitdiff
path: root/tests/auth_tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2023-01-13 05:49:36 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-01-17 11:49:15 +0100
commitba082e09524c9fba9fa8ba472c896ef645b09dd6 (patch)
treebaa219ce2de31f06daa5d25b8395df99322caade /tests/auth_tests
parent4d78d7338cc5cfaa0afcfc9d240d753328bbf399 (diff)
downloaddjango-ba082e09524c9fba9fa8ba472c896ef645b09dd6.tar.gz
Refs #33561 -- Made created=True required in signature of RemoteUserBackend.configure_user() subclasses.
Per deprecation timeline.
Diffstat (limited to 'tests/auth_tests')
-rw-r--r--tests/auth_tests/test_remote_user.py37
1 files changed, 1 insertions, 36 deletions
diff --git a/tests/auth_tests/test_remote_user.py b/tests/auth_tests/test_remote_user.py
index 9e6e0dce20..d923f5d60b 100644
--- a/tests/auth_tests/test_remote_user.py
+++ b/tests/auth_tests/test_remote_user.py
@@ -6,14 +6,7 @@ from django.contrib.auth.backends import RemoteUserBackend
from django.contrib.auth.middleware import RemoteUserMiddleware
from django.contrib.auth.models import User
from django.middleware.csrf import _get_new_csrf_string, _mask_cipher_secret
-from django.test import (
- Client,
- TestCase,
- ignore_warnings,
- modify_settings,
- override_settings,
-)
-from django.utils.deprecation import RemovedInDjango50Warning
+from django.test import Client, TestCase, modify_settings, override_settings
@override_settings(ROOT_URLCONF="auth_tests.urls")
@@ -279,34 +272,6 @@ class RemoteUserCustomTest(RemoteUserTest):
self.assertEqual(newuser.email, "user@example.com")
-# RemovedInDjango50Warning.
-class CustomRemoteUserNoCreatedArgumentBackend(CustomRemoteUserBackend):
- def configure_user(self, request, user):
- return super().configure_user(request, user)
-
-
-@ignore_warnings(category=RemovedInDjango50Warning)
-class RemoteUserCustomNoCreatedArgumentTest(RemoteUserTest):
- backend = "auth_tests.test_remote_user.CustomRemoteUserNoCreatedArgumentBackend"
-
-
-@override_settings(ROOT_URLCONF="auth_tests.urls")
-@modify_settings(
- AUTHENTICATION_BACKENDS={
- "append": "auth_tests.test_remote_user.CustomRemoteUserNoCreatedArgumentBackend"
- },
- MIDDLEWARE={"append": "django.contrib.auth.middleware.RemoteUserMiddleware"},
-)
-class RemoteUserCustomNoCreatedArgumentDeprecationTest(TestCase):
- def test_known_user_sync(self):
- msg = (
- "`created=True` must be added to the signature of "
- "CustomRemoteUserNoCreatedArgumentBackend.configure_user()."
- )
- with self.assertWarnsMessage(RemovedInDjango50Warning, msg):
- self.client.get("/remote_user/", **{RemoteUserTest.header: "newuser"})
-
-
class CustomHeaderMiddleware(RemoteUserMiddleware):
"""
Middleware that overrides custom HTTP auth user header.