CI / ruff · pytest (pull_request) Successful in 1m25s
Doctor list/card/alerts/ack/connect, dialog events/outbox/history and demo controls now read the identity and clinical DBs. Rule-based discontinuation risk index, trend, adherence; every doctor read is audited. Refs #12 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
from fastapi.testclient import TestClient
|
|
|
|
from app.db import session
|
|
from app.db.bootstrap import init_db
|
|
from app.dialog.contracts import Event, get_engine
|
|
from app.main import app
|
|
from app.services.contracts import get_monitoring
|
|
|
|
MEM = "sqlite+aiosqlite:///:memory:"
|
|
|
|
|
|
async def test_stubs_are_usable() -> None:
|
|
await session.configure(identity_url=MEM, clinical_url=MEM)
|
|
await init_db()
|
|
try:
|
|
replies = await get_engine().handle("tok", Event(type="text", text="привет"))
|
|
assert replies and replies[0].text
|
|
assert await get_monitoring().after_data_change("tok") == [] # unknown patient → no actions
|
|
assert await get_monitoring().is_in_crisis("tok") is False
|
|
finally:
|
|
await session.configure()
|
|
|
|
|
|
def test_api_fixtures_and_clock() -> None:
|
|
# Routes read the DB since #12 (covered by tests/test_api_*.py); fixtures stay as schema-valid reference data.
|
|
from app.api import fixtures
|
|
|
|
assert fixtures.card("tok-andrey") is not None and fixtures.PATIENTS[0].status_color == "red"
|
|
with TestClient(app) as c:
|
|
assert c.get("/api/v1/demo/clock").json()["virtual"] is True
|