"""Interface 52 belongs to the GPU worker; the gateway keeps its legacy routes.""" import asyncio import importlib from starlette.requests import Request def test_legacy_hairline_forwarding(monkeypatch): name, path = "hairline_generate", "/api/v1/hairline/generate" gateway = importlib.import_module("gateway.app") request = Request({"type": "http", "method": "POST", "path": path, "headers": []}) calls = [] async def proxy(actual_request, actual_path): assert actual_request is request calls.append(actual_path) return {"forwarded_to": actual_path} monkeypatch.setattr(gateway, "_proxy", proxy) endpoint = getattr(gateway, name) assert next(route for route in gateway.app.routes if getattr(route, "path", None) == path).endpoint is endpoint assert asyncio.run(endpoint(request)) == {"forwarded_to": path} assert calls == [path] def test_interface52_is_not_exposed_by_gateway(): gateway = importlib.import_module("gateway.app") assert not any(getattr(route, "path", None) == "/api/v1/hairline/generate-52" for route in gateway.app.routes)