Every test client speaks to 127.0.0.1, since an open door now answers 421 to a Host that is not loopback
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
6513e2ab95
commit
6e51134477
12 files changed
+19
-19
No files matched your search
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -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"]}]
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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)
|
||||
|
||||
+5
-5
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user