"""Explicit network-free Confluence substitute for development mode.""" import httpx from backend.confluence import ConfluenceClient def create_client(**kwargs): async def respond(request): if request.headers.get("authorization") != "Bearer dev-pat": return httpx.Response(401) path = request.url.path if path.endswith("/rest/api/space"): return httpx.Response(200, json={"results": [{"key": "OPS", "name": "Operations"}], "totalSize": 1}) if path.endswith("/rest/api/content/search"): return httpx.Response(200, json={"results": [{"id": "847291", "title": "Deployment Guide", "space": {"key": "OPS"}, "excerpt": "Deployment steps"}], "totalSize": 1}) if path.endswith("/rest/api/content/847291"): return httpx.Response(200, json={"id": "847291", "title": "Deployment Guide", "space": {"key": "OPS"}, "body": {"storage": {"value": "
Deploy service X using the release checklist.
"}}}) return httpx.Response(404) return ConfluenceClient(**kwargs, transport=httpx.MockTransport(respond))