Add some logging to test

This commit is contained in:
shamoon 2024-05-15 09:19:42 -07:00
parent 273dc24af0
commit f62d4da35a
2 changed files with 7 additions and 9 deletions

View File

@ -55,6 +55,12 @@ 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"

View File

@ -92,7 +92,7 @@ class TestRemoteUser(DirectoriesMixin, APITestCase):
"""
GIVEN:
- Configured user
- Remote user auth is disabled for the API
- Remote user auth enabled for frontend but disabled for the API
WHEN:
- API call is made to get documents
THEN:
@ -108,14 +108,6 @@ class TestRemoteUser(DirectoriesMixin, APITestCase):
):
_parse_remote_user_settings()
response = self.client.get("/api/documents/")
# 403 testing locally, 401 on ci...
self.assertIn(
response.status_code,
[status.HTTP_401_UNAUTHORIZED, status.HTTP_403_FORBIDDEN],
)
response = self.client.get(
"/api/documents/",
headers={