Hosts a to l declare READS: places, teaser, stated seniority and employment

Ashby, BambooHR, Deel, Eightfold, Gem, Greenhouse, HiBob, HR Manager, Jibe,
Jobylon and Lever move to feed_url(slug, ask) and page(get, slug, cursor, ask),
declare READS with the robots decision, and drop robots_page. Rows carry
places (Ashby secondaryLocations, Lever allLocations, Greenhouse offices in
place of a Hybrid placeholder), Jobylon keeps its summary as teaser and maps
experience and employment, Eightfold reads creationTs as the posting date and
Ashby reads workplaceType. Fixtures <name>-places.* and jobylon-teaser.html
drive the conformance checks; the eleven names leave UNDECLARED.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 09:11:53 +02:00
1 parent 4c0da58da7
commit f2e652a8da
35 files changed
+1290 -391

No files matched your search

+22 -30
View File
@@ -17,7 +17,7 @@ if str(ROOT) not in sys.path:
from app.jobs.discover import boards_in # noqa: E402
from plugins import ats, readers # noqa: E402
from plugins.readers import deel # noqa: E402
from plugins.readers import Ask, deel # noqa: E402
PAGE = (ROOT / "tests" / "fixtures" / "ats" / "deel.html").read_bytes()
URL = "https://jobs.deel.com/klarna"
@@ -46,6 +46,13 @@ def test_several_locations_are_joined_and_remote_uses_the_stores_words() -> None
assert rows["a8be45ac"]["location"] == "Stockholm; London; Milan; Warsaw"
assert rows["f96bb9d4"]["remote"] == "remote"
assert rows["f96bb9d4"]["location"] == "Ohio"
# Every place is kept, in the host's order; the work arrangement is the
# places' remote flag.
assert rows["a8be45ac"]["places"] == [
{"text": name, "remote": False} for name in ("Stockholm", "London", "Milan", "Warsaw")]
assert rows["f96bb9d4"]["places"] == [{"text": "Ohio", "remote": True}]
assert rows["f96bb9d4"]["employment"] == "contract" # "Consultant"
assert rows["21584046"]["employment"] == "full_time"
def test_pay_is_only_text_since_the_period_is_not_stated() -> None:
@@ -90,37 +97,23 @@ def test_a_posting_without_a_title_or_id_is_skipped() -> None:
# ------------------------------------------------------------ the fetch
@pytest.fixture
def web(monkeypatch: pytest.MonkeyPatch) -> dict[str, Any]:
answers: dict[str, Any] = {}
def test_the_board_is_one_request() -> None:
asked: list[str] = []
def fake_get(client, url, host, slug, *, method="GET", payload=None, headers=None,
www_twin=False):
def get(url: str, **kwargs: Any) -> bytes:
asked.append(url)
if not ats._allowed_host(host, slug)(httpx.URL(url).host):
raise ats._Refused(url)
answer = answers[url]
if isinstance(answer, BaseException):
raise answer
return answer
return PAGE
monkeypatch.setattr(ats, "_get", fake_get)
return {"answers": answers, "asked": asked}
rows = deel.parse(get(deel.feed_url("klarna", Ask())), "klarna")
assert len(rows) == 5 and asked == [URL]
def test_the_board_is_one_request_and_complete(web: dict[str, Any]) -> None:
web["answers"][URL] = PAGE
with httpx.Client() as client:
rows, complete = ats._fetch_rows(client, "deel:klarna")
assert len(rows) == 5 and complete
assert web["asked"] == [URL]
def test_a_page_that_cannot_be_read_fails_the_board(web: dict[str, Any]) -> None:
web["answers"][URL] = b"<html>Job Board Not Found</html>"
with httpx.Client() as client, pytest.raises(ValueError):
ats._fetch_rows(client, "deel:klarna")
def test_it_declares_a_whole_listing_read_from_the_page() -> None:
reads = deel.READS
assert (reads.listing, reads.text, reads.places, reads.complete) == (
"whole", "listing", "many", "whole")
assert reads.fields.pay == "line" and "/api/ is disallowed and not read" in reads.robots
assert not hasattr(deel, "robots_page")
# ------------------------------------------------------- slugs and hosts
@@ -131,10 +124,9 @@ def test_the_module_is_registered_as_a_feed_host() -> None:
assert not hasattr(deel, "page") and not hasattr(deel, "detail")
def test_the_urls_and_the_robots_page_are_the_boards_own() -> None:
def test_the_urls_are_the_boards_own() -> None:
assert deel.careers_url("klarna") == URL
assert deel.feed_url("klarna") == URL
assert deel.robots_page("klarna") == URL
assert deel.feed_url("klarna", Ask()) == URL
assert deel.allowed("klarna")("jobs.deel.com") and deel.allowed("klarna")("JOBS.DEEL.COM")
for host in ("deel.com", "api.deel.com", "jobs.deel.com.evil.example", "evil.example"):
assert not deel.allowed("klarna")(host)
@@ -159,7 +151,7 @@ def test_no_slug_reaches_another_host() -> None:
"""The host is fixed in every URL the module builds; a slug only ever
lands in the path."""
for slug in ("klarna", "Klarna", "a-b_c"):
for url in (deel.careers_url(slug), deel.feed_url(slug), deel.robots_page(slug)):
for url in (deel.careers_url(slug), deel.feed_url(slug, Ask())):
assert httpx.URL(url).host == "jobs.deel.com"