Files
jobboard/tests/test_ats_teamtailor.py
T
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

50 lines
1.9 KiB
Python

"""Teamtailor: every location of a role, kept as a place. No network: the
fixture is the trimmed feed of Kry and Tobii, read on 2026-09-29."""
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, teamtailor # noqa: E402
FIXTURES = ROOT / "tests" / "fixtures" / "ats"
def _rows() -> list[dict]:
return teamtailor.parse((FIXTURES / "teamtailor-places.xml").read_bytes(), "kry")
def test_the_declaration_says_what_the_feed_gives() -> None:
reads = teamtailor.READS
assert (reads.listing, reads.page_size, reads.places, reads.text, reads.complete) == \
("paged", 50, "many", "listing", "end")
assert reads.fields.posted == "trusted" and reads.fields.remote == "stated"
assert "/jobs.rss is allowed" in reads.robots
def test_page_takes_the_ask_and_reads_the_same_url() -> None:
asked: list[str] = []
def get(url: str, **_: object) -> bytes:
asked.append(url)
return (FIXTURES / "teamtailor-places.xml").read_bytes()
_items, results, total, cursor = teamtailor.page(get, "kry", None, Ask())
assert asked == ["https://kry.teamtailor.com/jobs.rss?per_page=50&offset=0"]
assert len(results) == 4 and total is None and cursor == 4
def test_every_distinct_location_is_a_place_with_the_roles_work_mode() -> None:
first, second, third = _rows()
# "Sverige" (a city that is a country) once, Stockholm's twin once.
assert first["places"] == [{"text": "Sverige, Sweden", "remote": False}, # hybrid
{"text": "Stockholm, Sweden", "remote": False}]
assert first["location"] == "Sverige, Sweden; Stockholm, Sweden"
assert second["places"] == [{"text": "Danderyd, Sweden", "remote": True}] # fully
assert third["places"] == [] and third["location"] == ""