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:
1 parent
4c0da58da7
commit
f2e652a8da
35 files changed
+1290
-391
No files matched your search
+33
-27
@@ -9,7 +9,6 @@ from datetime import UTC, datetime
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
@@ -18,7 +17,7 @@ if str(ROOT) not in sys.path:
|
||||
|
||||
from app.jobs import discover # noqa: E402
|
||||
from plugins import ats, readers # noqa: E402
|
||||
from plugins.readers import bamboohr # noqa: E402
|
||||
from plugins.readers import Ask, bamboohr # noqa: E402
|
||||
|
||||
FIXTURES = ROOT / "tests" / "fixtures" / "ats"
|
||||
|
||||
@@ -99,9 +98,10 @@ def test_detail_reads_the_text_the_date_and_the_country() -> None:
|
||||
found = bamboohr.detail(_get_of({url: _read("bamboohr-detail-37.json")}, asked),
|
||||
"configit", row)
|
||||
assert asked == [(url, {"Accept": "application/json"})]
|
||||
assert set(found) <= set(ats.DETAIL_FIELDS)
|
||||
assert set(found) <= set(ats.DETAIL_FIELDS) | {"places"}
|
||||
assert found["posted"] == datetime(2026, 9, 23, tzinfo=UTC)
|
||||
assert found["location"] == "København Ø, Denmark"
|
||||
assert found["places"] == [{"text": "København Ø, Denmark", "remote": None}]
|
||||
assert found["remote"] == "hybrid"
|
||||
text = found["description"]
|
||||
assert text.startswith("Our Global Marketing Team is looking for")
|
||||
@@ -125,38 +125,44 @@ def test_detail_refuses_an_answer_that_is_not_a_role() -> None:
|
||||
bamboohr.detail(_get_of({url: body}, []), "configit", row)
|
||||
|
||||
|
||||
def test_the_board_and_its_details_are_read_through_the_app(
|
||||
monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setattr(ats, "PAGE_DELAY", 0)
|
||||
def test_the_board_and_its_details_are_read_with_the_json_accept_on_the_detail() -> None:
|
||||
base = "https://configit.bamboohr.com/careers"
|
||||
seen: list[str] = []
|
||||
asked: list[tuple[str, Any]] = []
|
||||
answers: dict[str, bytes | Exception] = {
|
||||
f"{base}/list": _read("bamboohr.json"),
|
||||
f"{base}/37/detail": _read("bamboohr-detail-37.json")}
|
||||
get = _get_of(answers, asked)
|
||||
rows = bamboohr.parse(get(bamboohr.feed_url("configit", Ask())), "configit")
|
||||
assert len(rows) == 2
|
||||
found = bamboohr.detail(get, "configit", rows[1])
|
||||
assert [url for url, _ in asked] == [f"{base}/list", f"{base}/37/detail"]
|
||||
assert asked[1][1] == {"Accept": "application/json"}
|
||||
assert found["location"] == "København Ø, Denmark"
|
||||
assert found["posted"] == datetime(2026, 9, 23, tzinfo=UTC)
|
||||
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
seen.append(str(request.url))
|
||||
if request.url.path == "/careers/list":
|
||||
return httpx.Response(200, content=_read("bamboohr.json"))
|
||||
if request.url.path == "/careers/26/detail":
|
||||
return httpx.Response(404)
|
||||
assert request.headers["accept"] == "application/json"
|
||||
return httpx.Response(200, content=_read("bamboohr-detail-37.json"))
|
||||
|
||||
with httpx.Client(transport=httpx.MockTransport(handler)) as client:
|
||||
rows, complete = ats._fetch_rows(client, "bamboohr:configit")
|
||||
assert complete and len(rows) == 2 and seen == [f"{base}/list"]
|
||||
filled, done, failed = ats._read_details(client, "bamboohr:configit", rows, complete,
|
||||
set(), set())
|
||||
assert seen[1:] == [f"{base}/26/detail", f"{base}/37/detail"]
|
||||
# A 404 counts as read; the other role is filled from its own page.
|
||||
assert done == {"bamboohr:configit:26", "bamboohr:configit:37"} and failed == set()
|
||||
assert filled[0]["description"] == "" and filled[1]["location"] == "København Ø, Denmark"
|
||||
assert filled[1]["posted"] == datetime(2026, 9, 23, tzinfo=UTC)
|
||||
def test_the_role_states_one_place_and_the_employment() -> None:
|
||||
rows = bamboohr.parse(_read("bamboohr.json"), "configit")
|
||||
assert rows[1]["places"] == [{"text": "København Ø", "remote": None}]
|
||||
assert rows[1]["employment"] == "full_time"
|
||||
body = json.loads(_read("bamboohr.json"))
|
||||
body["result"][0] |= {"employmentStatusLabel": "Seasonal", "location": {"city": None}}
|
||||
first = bamboohr.parse(json.dumps(body).encode(), "configit")[0]
|
||||
assert first["places"] == [] and "employment" not in first
|
||||
|
||||
|
||||
def test_it_declares_what_it_reads() -> None:
|
||||
reads = bamboohr.READS
|
||||
assert (reads.listing, reads.text, reads.places, reads.fields.posted) == (
|
||||
"whole", "detail", "one", "trusted")
|
||||
assert reads.robots.startswith("read: robots.txt allows /careers")
|
||||
assert not hasattr(bamboohr, "robots_page")
|
||||
|
||||
|
||||
def test_the_slug_the_urls_and_the_allow_list() -> None:
|
||||
assert bamboohr.slug_ok("configit") and bamboohr.slug_ok("Configit")
|
||||
assert bamboohr.careers_url("configit") == "https://configit.bamboohr.com/careers"
|
||||
assert bamboohr.robots_page("configit") == "https://configit.bamboohr.com/careers"
|
||||
assert bamboohr.feed_url("Configit") == "https://configit.bamboohr.com/careers/list"
|
||||
assert bamboohr.feed_url("Configit", Ask()) == "https://configit.bamboohr.com/careers/list"
|
||||
allow = bamboohr.allowed("Configit")
|
||||
assert allow("configit.bamboohr.com") and allow("CONFIGIT.bamboohr.com")
|
||||
assert not allow("bamboohr.com") and not allow("other.bamboohr.com")
|
||||
|
||||
Reference in new issue
Block a user