mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-02-08 01:03:48 +02:00
Do not test authentication on docs endpoints
This commit is contained in:
parent
0ee73605c0
commit
eca502c49c
@ -31,6 +31,9 @@ ALLOWED_CONTROLLER_ENDPOINTS = [
|
|||||||
("/", "GET"),
|
("/", "GET"),
|
||||||
("/debug", "GET"),
|
("/debug", "GET"),
|
||||||
("/static/web-ui/{file_path:path}", "GET"),
|
("/static/web-ui/{file_path:path}", "GET"),
|
||||||
|
("/docs", "GET"),
|
||||||
|
("/docs/oauth2-redirect", "GET"),
|
||||||
|
("/redoc", "GET"),
|
||||||
("/v3/version", "GET"),
|
("/v3/version", "GET"),
|
||||||
("/v3/version", "POST"),
|
("/v3/version", "POST"),
|
||||||
("/v3/access/users/login", "POST"),
|
("/v3/access/users/login", "POST"),
|
||||||
@ -49,6 +52,7 @@ async def test_controller_endpoints_require_authentication(app: FastAPI, unautho
|
|||||||
if isinstance(route, APIRoute):
|
if isinstance(route, APIRoute):
|
||||||
for method in list(route.methods):
|
for method in list(route.methods):
|
||||||
if (route.path, method) not in ALLOWED_CONTROLLER_ENDPOINTS:
|
if (route.path, method) not in ALLOWED_CONTROLLER_ENDPOINTS:
|
||||||
|
print(f"Testing {route.path} {method}")
|
||||||
response = await getattr(unauthorized_client, method.lower())(route.path)
|
response = await getattr(unauthorized_client, method.lower())(route.path)
|
||||||
assert response.status_code == status.HTTP_401_UNAUTHORIZED
|
assert response.status_code == status.HTTP_401_UNAUTHORIZED
|
||||||
elif isinstance(route, APIWebSocketRoute):
|
elif isinstance(route, APIWebSocketRoute):
|
||||||
|
Loading…
Reference in New Issue
Block a user