from fastapi.testclient import TestClient from app.dialog.contracts import Event, get_engine from app.main import app from app.services.contracts import get_monitoring async def test_stubs_are_usable() -> None: replies = await get_engine().handle("tok", Event(type="text", text="привет")) assert replies and replies[0].text assert await get_monitoring().after_data_change("tok") == [] def test_api_fixture_routes() -> None: with TestClient(app) as c: patients = c.get("/api/v1/doctors/doc-smirnova/patients").json() assert patients[0]["status_color"] == "red" card = c.get("/api/v1/patients/tok-andrey", params={"doctor_id": "doc-smirnova"}).json() assert card["safety_plan"] and card["series"] assert c.post("/api/v1/dialog/tok-andrey/events", json={"type": "text", "text": "ok"}).status_code == 200 assert c.get("/api/v1/demo/clock").json()["virtual"] is True