FastAPI app, upstream Confluence/model adapters, authoritative history, rootless container lifecycle, artifact storage and downloads, fake peers under backend/dev, tests under tests/backend. Root pytest.ini deselects the live marker by default; requirements gain the backend dependencies.
19 lines
1.1 KiB
Python
19 lines
1.1 KiB
Python
"""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": "<p>Deploy service X using the release checklist.</p>"}}})
|
|
return httpx.Response(404)
|
|
return ConfluenceClient(**kwargs, transport=httpx.MockTransport(respond))
|