Share the readers' place, table-lookup and country helpers, unify the employment vocabulary, and list the enrich switch with the stages
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ca80219bbb
commit
903b69b6d3
34 files changed
+290
-207
No files matched your search
+17
-3
@@ -143,7 +143,7 @@ def client(app: FastAPI) -> Iterator[TestClient]:
|
||||
yield c
|
||||
|
||||
|
||||
def test_get_stages_lists_both_with_their_source_model_and_who_answers(
|
||||
def test_get_stages_lists_all_three_with_their_source_model_and_who_answers(
|
||||
client: TestClient, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
answered_by(monkeypatch, "api")
|
||||
res = client.get("/api/stages")
|
||||
@@ -156,6 +156,8 @@ def test_get_stages_lists_both_with_their_source_model_and_who_answers(
|
||||
{"name": "summarise", "on": False, "source": "config",
|
||||
"model": "claude-haiku-4-5-20251001", "backend": "api",
|
||||
"answer": "answered by the Claude API"},
|
||||
{"name": "enrich", "on": True, "source": "config", "model": "", "backend": "",
|
||||
"answer": "reads role pages, asks no model"},
|
||||
]
|
||||
|
||||
|
||||
@@ -164,7 +166,7 @@ def test_who_answers_is_said_for_the_api_claude_code_and_nobody(
|
||||
answers = {}
|
||||
for backend in ("api", "claude_code", ""):
|
||||
answered_by(monkeypatch, backend)
|
||||
[first, second] = client.get("/api/stages").json()
|
||||
[first, second, _enrich] = client.get("/api/stages").json()
|
||||
assert first["backend"] == second["backend"] == backend
|
||||
answers[backend] = first["answer"]
|
||||
|
||||
@@ -191,6 +193,18 @@ def test_put_stores_the_setting_returns_the_same_shape_and_starts_nothing(
|
||||
assert res.json()["on"] is False and store.state["stage:summarise"] == "off"
|
||||
|
||||
|
||||
def test_the_enrich_switch_is_listed_and_stored_like_the_others(
|
||||
client: TestClient, store: Store) -> None:
|
||||
res = client.put("/api/stages/enrich", json={"on": False})
|
||||
|
||||
assert res.status_code == 200
|
||||
assert res.json()["name"] == "enrich" and res.json()["on"] is False
|
||||
assert store.state["stage:enrich"] == "off"
|
||||
listed = {stage["name"]: stage for stage in client.get("/api/stages").json()}
|
||||
assert list(listed) == ["extract", "summarise", "enrich"]
|
||||
assert listed["enrich"]["on"] is False and listed["enrich"]["source"] == "stored"
|
||||
|
||||
|
||||
def test_an_unknown_stage_is_404_and_a_bad_body_is_422(client: TestClient) -> None:
|
||||
assert client.put("/api/stages/embed", json={"on": True}).status_code == 404
|
||||
assert client.put("/api/stages/extract", json={"on": "sometimes"}).status_code == 422
|
||||
@@ -200,7 +214,7 @@ def test_an_unknown_stage_is_404_and_a_bad_body_is_422(client: TestClient) -> No
|
||||
def test_agent_backend_off_is_named_rather_than_blamed_on_missing_keys(
|
||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch, store: Store) -> None:
|
||||
off = Config(database=str(tmp_path / "roledesk.db"), agent={"backend": "off"})
|
||||
[first, _] = stages.describe(off, store)
|
||||
[first, *_] = stages.describe(off, store)
|
||||
assert first.backend == "" and "agent.backend" in first.answer
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user