Do not test authentication on docs endpoints

This commit is contained in:
grossmj 2024-12-19 17:04:00 +07:00
parent 0ee73605c0
commit eca502c49c
No known key found for this signature in database
GPG Key ID: 1E7DD6DBB53FF3D7

View File

@ -31,6 +31,9 @@ ALLOWED_CONTROLLER_ENDPOINTS = [
("/", "GET"),
("/debug", "GET"),
("/static/web-ui/{file_path:path}", "GET"),
("/docs", "GET"),
("/docs/oauth2-redirect", "GET"),
("/redoc", "GET"),
("/v3/version", "GET"),
("/v3/version", "POST"),
("/v3/access/users/login", "POST"),
@ -49,6 +52,7 @@ async def test_controller_endpoints_require_authentication(app: FastAPI, unautho
if isinstance(route, APIRoute):
for method in list(route.methods):
if (route.path, method) not in ALLOWED_CONTROLLER_ENDPOINTS:
print(f"Testing {route.path} {method}")
response = await getattr(unauthorized_client, method.lower())(route.path)
assert response.status_code == status.HTTP_401_UNAUTHORIZED
elif isinstance(route, APIWebSocketRoute):