Test migration 32, the cut, saved filters and the override rescore, and bring the READMEs and config comments to fetch text and the cut
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
617356e60c
commit
8b6c6d5ac3
9 files changed
+260
-37
No files matched your search
@@ -1874,3 +1874,42 @@ def test_saving_queues_no_summary_when_the_stage_is_off_or_it_has_one(
|
||||
store.upsert_role(posting("3"))
|
||||
client.post("/api/applications", json={"role_uid": posting("3").uid})
|
||||
assert _summary_jobs(queue) == []
|
||||
|
||||
|
||||
# ------------------------------------------------------------ saved filters
|
||||
|
||||
def test_saved_filters_are_listed_saved_and_deleted_per_agent(
|
||||
client: TestClient, store: Store) -> None:
|
||||
one, two = store.save_agent("One"), store.save_agent("Two")
|
||||
url = f"/api/agents/{one.id}/filters"
|
||||
|
||||
made = client.post(url, json={"name": "Remote", "query": "remote=remote&order=newest"})
|
||||
assert made.status_code == 201
|
||||
row = made.json()
|
||||
assert set(row) == {"id", "name", "query", "created_at"}
|
||||
assert (row["name"], row["query"]) == ("Remote", "remote=remote&order=newest")
|
||||
client.post(url, json={"name": "berlin", "query": "places=place:berlin"})
|
||||
assert [f["name"] for f in client.get(url).json()] == ["berlin", "Remote"]
|
||||
assert client.get(f"/api/agents/{two.id}/filters").json() == []
|
||||
|
||||
assert client.post(url, json={"name": "remote", "query": "x=1"}).status_code == 409
|
||||
assert client.post(url, json={"name": " ", "query": "x=1"}).status_code == 422
|
||||
assert client.post("/api/agents/999/filters", json={"name": "A"}).status_code == 404
|
||||
assert client.get("/api/agents/999/filters").status_code == 404
|
||||
|
||||
assert client.delete(f"/api/filters/{row['id']}").status_code == 204
|
||||
assert client.delete(f"/api/filters/{row['id']}").status_code == 404
|
||||
assert [f["name"] for f in client.get(url).json()] == ["berlin"]
|
||||
|
||||
|
||||
def test_an_override_queues_a_rescore_and_fetch_text_either_way(
|
||||
client: TestClient, store: Store, queue: Any) -> None:
|
||||
"""All countries and All roles change the agents' fetch gates for the
|
||||
roles already stored, so either switch, on or off, rescores."""
|
||||
states = ("queued", "running", "done", "failed", "cancelled")
|
||||
store.add_company("Acme")
|
||||
assert client.post("/api/companies/acme/all-roles", json={"on": False}).status_code == 200
|
||||
found = queue.jobs.last("fetch_text", states=states)
|
||||
assert found is not None
|
||||
assert [queue.jobs.get(i).kind for i in found.depends_on] == ["score"]
|
||||
assert queue.jobs.last("pull", states=states) is None
|
||||
Reference in new issue
Block a user