]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix disable api remote auth test, Django 5.2 no longer uses process_request
authorshamoon <4887959+shamoon@users.noreply.github.com>
Wed, 6 Aug 2025 20:10:12 +0000 (16:10 -0400)
committershamoon <4887959+shamoon@users.noreply.github.com>
Wed, 6 Aug 2025 20:10:12 +0000 (16:10 -0400)
src/paperless/auth.py
src/paperless/tests/test_remote_user.py

index 36131847fbe3eba047c5006ac3000168124bf6b7..c68d63cf086e3cd2f957c78ba21e9ddfc39ec141 100644 (file)
@@ -54,7 +54,7 @@ class HttpRemoteUserMiddleware(PersistentRemoteUserMiddleware):
 
     header = settings.HTTP_REMOTE_USER_HEADER_NAME
 
-    def process_request(self, request: HttpRequest) -> None:
+    def __call__(self, request: HttpRequest) -> None:
         # If remote user auth is enabled only for the frontend, not the API,
         # then we need dont want to authenticate the user for API requests.
         if (
@@ -62,8 +62,8 @@ class HttpRemoteUserMiddleware(PersistentRemoteUserMiddleware):
             and "paperless.auth.PaperlessRemoteUserAuthentication"
             not in settings.REST_FRAMEWORK["DEFAULT_AUTHENTICATION_CLASSES"]
         ):
-            return
-        return super().process_request(request)
+            return self.get_response(request)
+        return super().__call__(request)
 
 
 class PaperlessRemoteUserAuthentication(authentication.RemoteUserAuthentication):
index ebe1b3ff5d3e125c8dbe913b2eed1db0895c0754..78b3393d5665132f830f1dc4c8d6b808dbd7f645 100644 (file)
@@ -1,6 +1,7 @@
 import os
 from unittest import mock
 
+from django.conf import settings
 from django.contrib.auth.models import User
 from django.test import override_settings
 from rest_framework import status
@@ -91,6 +92,7 @@ class TestRemoteUser(DirectoriesMixin, APITestCase):
 
     @override_settings(
         REST_FRAMEWORK={
+            **settings.REST_FRAMEWORK,
             "DEFAULT_AUTHENTICATION_CLASSES": [
                 "rest_framework.authentication.BasicAuthentication",
                 "rest_framework.authentication.TokenAuthentication",