PMFlow/backend/tests/test_api_router_order.py

23 lines
814 B
Python

from app.api.router import api_router
def test_project_signal_route_uses_single_sstc_canonical_endpoint() -> None:
canonical = []
legacy = []
for route in api_router.routes:
path = getattr(route, "path", "")
methods = set(getattr(route, "methods", set()) or set())
if path == "/projects/{project_id}/signals" and "GET" in methods:
endpoint = getattr(route, "endpoint", None)
canonical.append(
(
getattr(endpoint, "__module__", ""),
getattr(endpoint, "__name__", ""),
)
)
if path == "/projects/{project_id}/linked-signals" and "GET" in methods:
legacy.append(path)
assert canonical == [("app.api.sstc", "list_signals")]
assert legacy == []