Try to manually change settings in test
This commit is contained in:
parent
f62d4da35a
commit
113c7fea3a
@ -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"
|
||||
|
@ -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/",
|
||||
|
Loading…
x
Reference in New Issue
Block a user