"""The Lever host module's places, country and employment, against a small saved board. 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, lever # noqa: E402 BOARD = (ROOT / "tests" / "fixtures" / "ats" / "lever-places.json").read_bytes() def test_every_place_of_all_locations_is_kept_once() -> None: several, one = lever.parse(BOARD, "acme") assert several["places"] == [{"text": "London", "remote": None}, {"text": "Stockholm", "remote": None}] assert several["location"] == "London; Stockholm" assert one["places"] == [{"text": "Berlin", "remote": None}] def test_the_country_is_only_taken_for_a_role_at_one_place() -> None: several, one = lever.parse(BOARD, "acme") assert "country" not in several and one["country"] == "DE" def test_the_commitment_is_mapped_and_a_permanent_one_is_left_unmapped() -> None: several, one = lever.parse(BOARD, "acme") assert several["employment"] == "full_time" and "employment" not in one def test_it_declares_a_whole_listing_of_trusted_dates_and_no_robots_check() -> None: reads = lever.READS assert (reads.listing, reads.text, reads.places) == ("whole", "listing", "many") assert reads.fields.posted == "trusted" and reads.fields.country == "stated" assert reads.robots == "api: no robots.txt check needed (public board API), 2026-09-30" assert lever.feed_url("eu/tomtom", Ask()) == "https://api.eu.lever.co/v0/postings/tomtom?mode=json"