Add some logging to test
This commit is contained in:
parent
273dc24af0
commit
f62d4da35a
@ -55,6 +55,12 @@ 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"
|
||||||
|
@ -92,7 +92,7 @@ class TestRemoteUser(DirectoriesMixin, APITestCase):
|
|||||||
"""
|
"""
|
||||||
GIVEN:
|
GIVEN:
|
||||||
- Configured user
|
- Configured user
|
||||||
- Remote user auth is disabled for the API
|
- Remote user auth enabled for frontend but disabled for the API
|
||||||
WHEN:
|
WHEN:
|
||||||
- API call is made to get documents
|
- API call is made to get documents
|
||||||
THEN:
|
THEN:
|
||||||
@ -108,14 +108,6 @@ class TestRemoteUser(DirectoriesMixin, APITestCase):
|
|||||||
):
|
):
|
||||||
_parse_remote_user_settings()
|
_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(
|
response = self.client.get(
|
||||||
"/api/documents/",
|
"/api/documents/",
|
||||||
headers={
|
headers={
|
||||||
|
Loading…
x
Reference in New Issue
Block a user