Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a39404384 |
1 changed files with 16 additions and 0 deletions
|
|
@ -655,6 +655,22 @@ def test_public_reads_are_documented_as_unauthenticated(path):
|
|||
assert operation["security"] == []
|
||||
|
||||
|
||||
def test_every_route_is_in_the_documented_surface():
|
||||
"""No APIRoute may escape the spec — an undocumented route dodges the pair."""
|
||||
from fastapi.routing import APIRoute
|
||||
from main import app as _app
|
||||
|
||||
spec = _spec()
|
||||
missing = []
|
||||
for route in _app.routes:
|
||||
if not isinstance(route, APIRoute): # Mount, WebSocket, included routers
|
||||
continue
|
||||
for method in route.methods:
|
||||
if spec["paths"].get(route.path, {}).get(method.lower()) is None:
|
||||
missing.append(f"{method} {route.path}")
|
||||
assert missing == []
|
||||
|
||||
|
||||
def test_mutating_surface_is_admin_only_except_the_public_three():
|
||||
"""22 mutating operations are published; 19 need the admin session."""
|
||||
mutating = [(method, path, operation["security"])
|
||||
|
|
|
|||
Loading…
Reference in a new issue