cmvr-visual/backend/tests/test_readiness.py
zhanghao 88cf14d794 feat: consolidate story studio and editable automatic production
Restructure backend and frontend modules; add story, library, and editor schema migrations.

Support editable automatic production, manual confirmation modes, account and user lifecycle management, compact container scrolling, consistent forms, and per-task result previews.

Update inference and TTS scheduling, deployment guidance, and regression coverage; remove obsolete standalone pages and temporary acceptance artifacts.
2026-11-14 14:07:26 +08:00

34 lines
1.5 KiB
Python

async def test_readiness_distinguishes_protocol_and_drain_from_gpu_capacity(system):
assert (await system.client.get("/api/live")).status_code == 200
async def capabilities():
return {"protocol_version": 2, "admission_policy": True}
system.provider.upstream_capabilities = capabilities
response = await system.client.get("/api/ready")
assert response.status_code == 200
async def old_protocol():
return {"protocol_version": 1}
system.provider.upstream_capabilities = old_protocol
assert (await system.client.get("/api/ready")).status_code == 503
assert (await system.client.get("/api/live")).status_code == 200
system.provider.upstream_capabilities = capabilities
system.app.state.draining = True
assert (await system.client.get("/api/ready")).status_code == 503
async def test_editor_capability_explicitly_advertises_compatible_schema(system):
value = (await system.client.get("/api/capabilities")).json()
assert value["editable_production"] == {"schema_version": 1}
async def test_maintenance_keeps_reads_and_login_but_blocks_draft_writes(system):
marker = system.settings.state_root / "maintenance"
marker.write_text("upgrade")
assert (await system.client.get("/api/auth/me")).status_code == 200
response = await system.client.post("/api/workflows", json={})
assert response.status_code == 503 and response.json()["detail"]["code"] == "maintenance"
assert (await system.client.get("/api/live")).status_code == 200