Wire freehire, Jobnet and Akademikernes Jobbank into the CLI, the Sources form, dupes and the docs

Provider names, the CLI's choices and the dupes rule's search hosts now come from readers.PROVIDERS, and the regions, work modes and remote words from the modules' REGIONS, MODES and REMOTE, read with getattr so main works before and after the readers merge.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Sonnet 5.5 committed 2026-10-03 12:24:34 +02:00
1 parent 018a1ad895
commit 6e6e655203
16 files changed
+422 -39

No files matched your search

+51
View File
@@ -1357,6 +1357,57 @@ def test_a_search_is_tried_saved_updated_and_removed(
assert again["source"]["id"] == sub_id and again["source"]["on"] is True
def test_the_newer_providers_save_with_their_own_params(
client: TestClient, store: Store, search_stubs: dict[str, Any],
monkeypatch: pytest.MonkeyPatch) -> None:
_fake_search(monkeypatch, 2)
freehire = client.post("/api/searches", json={
"provider": "freehire", "name": "Head of data", "q": "head of data",
"country": "DK,se", "remote": "hybrid", "area": 1, "region": "x"}).json()
assert freehire["source"]["target"] == "freehire:head-of-data"
assert freehire["source"]["params"] == {"q": "head of data", "country": "dk,se",
"remote": "hybrid"}
jobnet = client.post("/api/searches/try", json={
"provider": "jobnet", "q": "data", "region": "Midtjylland", "remote": "helt"})
assert jobnet.status_code == 200 and jobnet.json()["found"] == 2
jobbank = client.post("/api/searches", json={
"provider": "jobbank", "name": "Data director", "q": "data director", "region": "2",
"remote": "helt"}).json()
assert jobbank["source"]["params"] == {"q": "data director", "region": "2", "remote": "helt"}
refused = client.post("/api/searches", json={
"provider": "jobnet", "name": "Bad", "q": "data", "region": "Fyn"})
assert refused.status_code == 422 and "region" in refused.json()["detail"]
assert [s.board for s in store.subscriptions(source="search")] == ["freehire", "jobbank"]
def test_the_sources_form_offers_the_providers_that_are_loaded(
client: TestClient, search_stubs: dict[str, Any]) -> None:
page = client.get("/settings/sources").text
for option in ('<option value="freehire">freehire (tech, many countries)</option>',
'<option value="jobnet">Jobnet (Denmark)</option>',
'<option value="jobbank">Akademikernes Jobbank (Denmark)</option>',
'<option value="HovedstadenOgBornholm">Hovedstaden og Bornholm</option>',
'<option value="2">Storkøbenhavn</option>',
'<option value="hybrid">Hybrid</option>',
'<option value="delvist">Partly remote</option>'):
assert option in page
for control in ('id="s-countries"', 'id="s-mode"', 'id="s-region-jobnet"',
'id="s-region-jobbank"', 'id="s-remote-jobbank"', 'id="s-region"'):
assert page.count(control) == 1
assert 'value="jobindex"' in page and 'value="platsbanken"' in page
def test_the_sources_form_renders_without_the_newer_providers(
client: TestClient, monkeypatch: pytest.MonkeyPatch) -> None:
from plugins import readers
for name in ("freehire", "jobnet", "jobbank"):
monkeypatch.delitem(readers.PROVIDERS, name, raising=False)
page = client.get("/settings/sources").text
assert 'value="adzuna"' in page and 'value="freehire"' not in page
assert 'id="s-region-jobnet"' in page and 'value="HovedstadenOgBornholm"' not in page
def test_a_search_that_finds_nothing_or_is_malformed_is_refused(
client: TestClient, store: Store, monkeypatch: pytest.MonkeyPatch) -> None:
_fake_search(monkeypatch, 0)