30 lines
984 B
Python
30 lines
984 B
Python
from fastapi.testclient import TestClient
|
|
|
|
from app.infrastructure.database import PendingAction, SessionLocal, init_db
|
|
from app.main import app
|
|
|
|
|
|
def test_websocket_ingestion_creates_pending_action():
|
|
init_db()
|
|
session = SessionLocal()
|
|
session.query(PendingAction).delete()
|
|
session.commit()
|
|
session.close()
|
|
|
|
with TestClient(app) as client:
|
|
with client.websocket_connect("/ws/transcript") as socket:
|
|
socket.send_json(
|
|
{
|
|
"speaker": "Planner",
|
|
"timestamp": "2026-06-26T12:00:00Z",
|
|
"text": "Create a task for Maria to confirm the photographer.",
|
|
}
|
|
)
|
|
response = socket.receive_json()
|
|
|
|
assert response["ok"] is True
|
|
assert response["pending_action_id"] is not None
|
|
|
|
dashboard = client.get("/dashboard").json()
|
|
assert any(action["tool"] == "create_task" for action in dashboard["pending_actions"])
|