From 113c7fea3a722b778e1df621fe7837347a11955e Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 15 May 2024 10:27:09 -0700 Subject: [PATCH] Try to manually change settings in test --- src/paperless/auth.py | 6 ------ src/paperless/tests/test_remote_user.py | 10 ++++++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/paperless/auth.py b/src/paperless/auth.py index 01836463c..6ca97d608 100644 --- a/src/paperless/auth.py +++ b/src/paperless/auth.py @@ -55,12 +55,6 @@ class HttpRemoteUserMiddleware(PersistentRemoteUserMiddleware): def process_request(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. - logger.debug( - request.path, - ) - logger.debug( - settings.REST_FRAMEWORK["DEFAULT_AUTHENTICATION_CLASSES"], - ) if ( "/api/" in request.path and "paperless.auth.PaperlessRemoteUserAuthentication" diff --git a/src/paperless/tests/test_remote_user.py b/src/paperless/tests/test_remote_user.py index 4e9c11dc9..d236e556b 100644 --- a/src/paperless/tests/test_remote_user.py +++ b/src/paperless/tests/test_remote_user.py @@ -107,6 +107,16 @@ class TestRemoteUser(DirectoriesMixin, APITestCase): }, ): _parse_remote_user_settings() + from django.conf import settings + + # Only needed in testing (on ci?), in production this is handled in the settings + if ( + "paperless.auth.PaperlessRemoteUserAuthentication" + in settings.REST_FRAMEWORK["DEFAULT_AUTHENTICATION_CLASSES"] + ): + settings.REST_FRAMEWORK["DEFAULT_AUTHENTICATION_CLASSES"].remove( + "paperless.auth.PaperlessRemoteUserAuthentication", + ) response = self.client.get( "/api/documents/",