"""Recruitee: every location of an offer, the placeholder that is not one, the level and the employment it states. No network: the fixture has the shape of bunq's board, read on 2026-09-30.""" 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, recruitee # noqa: E402 FIXTURES = ROOT / "tests" / "fixtures" / "ats" def _rows() -> list[dict]: return recruitee.parse((FIXTURES / "recruitee-places.json").read_bytes(), "acme") def test_the_declaration_says_what_the_feed_gives() -> None: reads = recruitee.READS assert (reads.listing, reads.places, reads.text) == ("whole", "many", "listing") assert reads.fields.posted == "trusted" and reads.fields.country == "none" assert reads.robots.startswith("api: no robots.txt check needed") assert recruitee.feed_url("acme", Ask()) == "https://acme.recruitee.com/api/offers/" def test_every_location_is_a_place_and_no_country_is_stated() -> None: first, _remote, berlin = _rows() assert [p["text"] for p in first["places"]] == [ "Amsterdam, Noord-Holland, Netherlands", "Sofia, Bulgaria"] assert first["location"] == "Amsterdam, Noord-Holland, Netherlands; Sofia, Bulgaria" assert "country" not in first # prep derives it from the places assert berlin["places"] == [{"text": "Berlin, Germany", "remote": None}] def test_remote_job_is_not_a_place() -> None: remote = _rows()[1] assert remote["places"] == [{"text": "Remote", "remote": True}] assert remote["location"] == "Remote" offer = {"id": 1, "title": "T", "careers_url": "https://a.example/o/t", "location": "Remote job", "remote": False} assert recruitee._places(offer) == [] def test_an_offer_without_a_locations_list_falls_back_to_its_location() -> None: offer = {"location": "Lisbon, Portugal", "country_code": "pt"} assert recruitee._places(offer) == [{"text": "Lisbon, Portugal", "remote": None}] def test_the_stated_level_and_employment_are_the_hosts_codes() -> None: rows = _rows() assert [r["seniority"] for r in rows] == ["experienced", "entry_level", "student_school"] assert [r["employment"] for r in rows] == [ "fulltime_permanent", "parttime_permanent", "internship"]