diff --git a/tests/test_api_reach.py b/tests/test_api_reach.py index ce3cae1..68673e6 100644 --- a/tests/test_api_reach.py +++ b/tests/test_api_reach.py @@ -36,7 +36,7 @@ def store(app: FastAPI) -> Store: @pytest.fixture def client(app: FastAPI) -> Iterator[TestClient]: - with TestClient(app) as c: + with TestClient(app, base_url="http://127.0.0.1") as c: yield c @@ -125,7 +125,7 @@ def test_fetch_text_answers_with_the_viewing_agents_vote( def test_a_stage_shows_the_model_that_will_answer(tmp_path: Path) -> None: config = Config(database=tmp_path / "x.db") app = create_app(config) - with TestClient(app) as client: + with TestClient(app, base_url="http://127.0.0.1") as client: by_name = {s["name"]: s for s in client.get("/api/stages").json()} assert by_name["extract"]["model"] == config.extract.model config.agent.model = "claude-opus-4-1" diff --git a/tests/test_board_size.py b/tests/test_board_size.py index 57e8090..0bcc20a 100644 --- a/tests/test_board_size.py +++ b/tests/test_board_size.py @@ -359,7 +359,7 @@ def app(tmp_path: Path) -> FastAPI: @pytest.fixture def client(app: FastAPI) -> Iterator[TestClient]: - with TestClient(app) as c: + with TestClient(app, base_url="http://127.0.0.1") as c: yield c diff --git a/tests/test_cv_feed.py b/tests/test_cv_feed.py index a26f833..97f4c9e 100644 --- a/tests/test_cv_feed.py +++ b/tests/test_cv_feed.py @@ -47,7 +47,7 @@ def store(app: FastAPI) -> Store: @pytest.fixture def client(app: FastAPI) -> Iterator[TestClient]: - with TestClient(app) as c: + with TestClient(app, base_url="http://127.0.0.1") as c: yield c diff --git a/tests/test_feed_ui.py b/tests/test_feed_ui.py index ad3ba38..03c0d26 100644 --- a/tests/test_feed_ui.py +++ b/tests/test_feed_ui.py @@ -32,7 +32,7 @@ def store(app: FastAPI) -> Store: @pytest.fixture def client(app: FastAPI) -> Iterator[TestClient]: - with TestClient(app) as c: + with TestClient(app, base_url="http://127.0.0.1") as c: yield c diff --git a/tests/test_fetch_terms.py b/tests/test_fetch_terms.py index c12303e..1a09b0f 100644 --- a/tests/test_fetch_terms.py +++ b/tests/test_fetch_terms.py @@ -532,7 +532,7 @@ def app(tmp_path: Path) -> FastAPI: @pytest.fixture def client(app: FastAPI) -> Iterator[TestClient]: - with TestClient(app) as c: + with TestClient(app, base_url="http://127.0.0.1") as c: yield c diff --git a/tests/test_fetch_text.py b/tests/test_fetch_text.py index fe9b77d..57385d2 100644 --- a/tests/test_fetch_text.py +++ b/tests/test_fetch_text.py @@ -443,7 +443,7 @@ def app(tmp_path: Path) -> FastAPI: @pytest.fixture def client(app: FastAPI) -> Iterator[TestClient]: - with TestClient(app) as c: + with TestClient(app, base_url="http://127.0.0.1") as c: yield c diff --git a/tests/test_limits.py b/tests/test_limits.py index dcd72d1..684e11a 100644 --- a/tests/test_limits.py +++ b/tests/test_limits.py @@ -179,7 +179,7 @@ def store(app: FastAPI) -> Store: @pytest.fixture def client(app: FastAPI) -> Iterator[TestClient]: - with TestClient(app) as c: + with TestClient(app, base_url="http://127.0.0.1") as c: yield c diff --git a/tests/test_prep.py b/tests/test_prep.py index 032db8c..710a2e9 100644 --- a/tests/test_prep.py +++ b/tests/test_prep.py @@ -383,7 +383,7 @@ def test_the_api_lists_the_unmapped_words(tmp_path: Path) -> None: database=tmp_path / "roledesk.db")) app.state.store.upsert_role(item("1", employment="Zero hours")) prep.run(app.state.store, tables=TABLES) - with TestClient(app) as client: + with TestClient(app, base_url="http://127.0.0.1") as client: found = client.get("/api/prep/unmapped").json() assert [(w["field"], w["host"], w["word"], w["roles"]) for w in found] == \ [("employment", "acme", "zero hours", 1)] @@ -399,7 +399,7 @@ def test_the_api_lists_the_unlinked_places(tmp_path: Path) -> None: database=tmp_path / "roledesk.db")) app.state.store.upsert_role(item("1", place="Ellwangen", country="DE")) prep.run(app.state.store, tables=TABLES) - with TestClient(app) as client: + with TestClient(app, base_url="http://127.0.0.1") as client: found = client.get("/api/prep/unlinked").json() assert found == [{"fold": "ellwangen", "text": "Ellwangen", "roles": 1, "countries": [["DE", 1]], "companies": ["Acme"]}] diff --git a/tests/test_remote.py b/tests/test_remote.py index 035b46d..00f94b8 100644 --- a/tests/test_remote.py +++ b/tests/test_remote.py @@ -472,7 +472,7 @@ def test_the_api_suggests_labels_and_filters_the_remote_tokens(tmp_path: Path) - store.replace_scores(agent.id, [ (c.uid, 0.5, ", ".join(score.failed_gates(c, agent.gates))) for c in store.score_candidates(agent.id, agent.gates)]) - with TestClient(app) as client: + with TestClient(app, base_url="http://127.0.0.1") as client: found = client.get("/api/suggest/places", params={"q": "remote"}).json() assert found[0] == {"token": "remote:any", "label": "Remote", "kind": "remote", "count": 2} diff --git a/tests/test_stages.py b/tests/test_stages.py index 66ad19a..a779f99 100644 --- a/tests/test_stages.py +++ b/tests/test_stages.py @@ -140,7 +140,7 @@ def app(tmp_path: Path) -> FastAPI: @pytest.fixture def client(app: FastAPI) -> Iterator[TestClient]: - with TestClient(app) as c: + with TestClient(app, base_url="http://127.0.0.1") as c: yield c @@ -237,7 +237,7 @@ def test_the_summarise_button_works_with_the_stage_off( data={"summaries": [{"uid": i["uid"], "summary": "Backend role, Python."} for i in kw["question"]["summaries"]]}, backend="api")) - res = TestClient(app).post(f"/api/roles/{uid}/summarise") + res = TestClient(app, base_url="http://127.0.0.1").post(f"/api/roles/{uid}/summarise") assert res.status_code == 202 app.state.queue.drain(timeout=30) diff --git a/tests/test_web.py b/tests/test_web.py index 2b4b8e7..16b661c 100644 --- a/tests/test_web.py +++ b/tests/test_web.py @@ -69,7 +69,7 @@ def queue(app: FastAPI) -> Any: @pytest.fixture def client(app: FastAPI) -> Iterator[TestClient]: - with TestClient(app) as c: + with TestClient(app, base_url="http://127.0.0.1") as c: yield c @@ -1763,7 +1763,7 @@ def test_the_pull_a_source_switch_queues_is_refused_quietly_while_one_runs( nothing else here needs mocking.""" from app.jobs import pull - client = TestClient(app) + client = TestClient(app, base_url="http://127.0.0.1") board = store.add_subscription("ats", "greenhouse:acme", label="Acme", company="Acme", board="greenhouse") running = pull.claim_run(store) @@ -1830,7 +1830,7 @@ def test_summarise_queues_one_role_and_the_job_writes_it( monkeypatch.setitem(JOBS, "summarise_batch", replace(JOBS["summarise_batch"], isolate=False, timeout=0.0)) - client = TestClient(app) + client = TestClient(app, base_url="http://127.0.0.1") upsert(store, posting("1")) upsert(store, posting("2")) uid, bare = posting("1").uid, posting("2").uid @@ -1920,7 +1920,7 @@ def test_saving_or_liking_a_role_queues_its_summary_once( monkeypatch.setattr(agent, "backend", lambda settings: "api") app.state.config.summarise.enabled = True - client = TestClient(app) + client = TestClient(app, base_url="http://127.0.0.1") upsert(store, posting("1")) upsert(store, posting("2")) saved, liked = posting("1").uid, posting("2").uid @@ -1945,7 +1945,7 @@ def test_saving_queues_no_summary_when_the_stage_is_off_or_it_has_one( from desk.tools import agent monkeypatch.setattr(agent, "backend", lambda settings: "api") - client = TestClient(app) + client = TestClient(app, base_url="http://127.0.0.1") upsert(store, posting("1")) upsert(store, posting("2")) off, done = posting("1").uid, posting("2").uid diff --git a/tests/test_web_reach.py b/tests/test_web_reach.py index 969d69d..7f40d68 100644 --- a/tests/test_web_reach.py +++ b/tests/test_web_reach.py @@ -29,7 +29,7 @@ def store(app: FastAPI) -> Store: @pytest.fixture def client(app: FastAPI) -> Iterator[TestClient]: - with TestClient(app) as c: + with TestClient(app, base_url="http://127.0.0.1") as c: yield c