Files
jobboard/tests/test_ats_greenhouse.py
T
WolfandClaude Opus 5.5 f2e652a8da 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>
2026-09-30 09:11:53 +02:00

53 lines
2.3 KiB
Python

"""The Greenhouse host module's places, against a small saved board with
`offices`. No network. The pay and the plain row are in `test_ats.py`."""
from __future__ import annotations
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from plugins.readers import Ask, greenhouse # noqa: E402
BOARD = (ROOT / "tests" / "fixtures" / "ats" / "greenhouse-places.json").read_bytes()
def test_a_placeholder_location_is_replaced_by_the_offices() -> None:
hybrid = greenhouse.parse(BOARD, "acme")[0]
assert hybrid["places"] == [
{"text": "Austin, TX, United States", "remote": None},
{"text": "New York, New York, United States", "remote": None}]
assert hybrid["location"] == "Austin, TX, United States; New York, New York, United States"
def test_a_name_the_offices_do_not_contain_is_one_more_place() -> None:
remote = greenhouse.parse(BOARD, "acme")[1]
assert [p["text"] for p in remote["places"]] == ["Remote India", "Bangalore, India"]
assert remote["places"][0]["remote"] is True
def test_a_name_an_office_repeats_is_one_place() -> None:
lisbon = greenhouse.parse(BOARD, "acme")[2]
assert lisbon["places"] == [{"text": "Lisbon, Portugal", "remote": None}]
def test_without_offices_the_name_is_the_place() -> None:
body = b'{"jobs": [{"id": 1, "title": "T", "absolute_url": "https://gh.example/1", ' \
b'"location": {"name": "Hybrid"}}, {"id": 2, "title": "U", ' \
b'"absolute_url": "https://gh.example/2", "location": {"name": ""}}]}'
hybrid, nothing = greenhouse.parse(body, "acme")
assert hybrid["places"] == [{"text": "Hybrid", "remote": None}]
assert nothing["places"] == [] and nothing["location"] == ""
def test_it_declares_a_whole_listing_of_trusted_dates_and_no_robots_check() -> None:
reads = greenhouse.READS
assert (reads.listing, reads.text, reads.places) == ("whole", "listing", "many")
assert reads.fields.posted == "trusted" and reads.fields.pay == "figures"
assert reads.robots == "api: no robots.txt check needed (public board API), 2026-09-30"
assert greenhouse.feed_url("acme", Ask()).endswith("/boards/acme/jobs?content=true&pay_transparency=true")
assert greenhouse.fallback_url("acme").endswith("/boards/acme/jobs")