Files
jobboard/tests/test_ats_recruitee.py
WolfandClaude Fable 5.1 2349fc424b Require READS, search params and a dated robots record; record robots.txt per requested path
Every reader declares, so undeclared(), the scope() fallback, robots_page and
ROBOTS_ANY_CASE go. A search provider needs PARAMS and clean_params, a row may
carry company, places gains none. Each robots record names the paths the
reader requests, from robots.txt read again on 2026-09-30. Platsbanken states
remote, HR Manager states no place.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-30 15:51:13 +02:00

60 lines
2.3 KiB
Python

"""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 "/api/offers/ is allowed" in reads.robots
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"]