59014f6fe7
Full implementations replacing stubs: speakers CRUD with utterance count, rooms list + mute/unmute via pipeline, FTS5-based search, RAG /ask and /summary endpoints. 15 route tests (8 new) all passing; 35 total. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
22 lines
972 B
Python
22 lines
972 B
Python
def test_ask_returns_response(api_client, seeded_db, mocker):
|
|
mock_post = mocker.patch("app.api.routes.rag.httpx.post")
|
|
mock_post.return_value.json.return_value = {
|
|
"message": {"content": "You talked about groceries."}
|
|
}
|
|
mock_post.return_value.raise_for_status = lambda: None
|
|
room = seeded_db.execute("SELECT id FROM rooms WHERE name='Kitchen'").fetchone()
|
|
seeded_db.execute(
|
|
"INSERT INTO utterances (room_id, transcript, match_status, start_time, end_time) VALUES (?,?,?,?,?)",
|
|
(room["id"], "we need milk from the store", "unknown", "2026-01-01 10:00:00", "2026-01-01 10:00:03"),
|
|
)
|
|
seeded_db.commit()
|
|
resp = api_client.post("/api/ask", json={"question": "What did we need from the store?"})
|
|
assert resp.status_code == 200
|
|
data = resp.json()
|
|
assert "answer" in data
|
|
|
|
|
|
def test_get_summary_not_found(api_client):
|
|
resp = api_client.get("/api/summary/2026-01-01")
|
|
assert resp.status_code == 404
|