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:
|
def process_request(self, request: HttpRequest) -> None:
|
||||||
# If remote user auth is enabled only for the frontend, not the API,
|
# 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.
|
# 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 (
|
if (
|
||||||
"/api/" in request.path
|
"/api/" in request.path
|
||||||
and "paperless.auth.PaperlessRemoteUserAuthentication"
|
and "paperless.auth.PaperlessRemoteUserAuthentication"
|
||||||
|
@ -107,6 +107,16 @@ class TestRemoteUser(DirectoriesMixin, APITestCase):
|
|||||||
},
|
},
|
||||||
):
|
):
|
||||||
_parse_remote_user_settings()
|
_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(
|
response = self.client.get(
|
||||||
"/api/documents/",
|
"/api/documents/",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user