Files
linkedstorm/tests/routes/test_search.py
T
pluto 59014f6fe7 feat: API routes — speakers, rooms, search, RAG
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>
2026-05-28 10:46:24 -05:00

19 lines
754 B
Python

def test_search_returns_matches(api_client, seeded_db):
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"], "the grocery list is ready", "unknown", "2026-01-01 10:00:00", "2026-01-01 10:00:03"),
)
seeded_db.commit()
resp = api_client.get("/api/search?q=grocery")
assert resp.status_code == 200
data = resp.json()
assert len(data) == 1
assert "grocery" in data[0]["transcript"]
def test_search_no_results(api_client):
resp = api_client.get("/api/search?q=xyznotfound")
assert resp.status_code == 200
assert resp.json() == []