Files
jobboard/tests/test_ats_personio.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

45 lines
1.7 KiB
Python

"""Personio: every office of a role, the level and the employment it states.
No network: the fixtures are saved feeds."""
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, personio # noqa: E402
FIXTURES = ROOT / "tests" / "fixtures" / "ats"
def _rows() -> list[dict]:
return personio.parse((FIXTURES / "personio-places.xml").read_bytes(), "acme")
def test_the_declaration_says_what_the_feed_gives() -> None:
reads = personio.READS
assert (reads.listing, reads.places, reads.text) == ("whole", "many", "listing")
assert reads.fields.posted == "trusted" and reads.fields.seniority == "stated"
assert reads.robots.startswith("read: /xml")
assert personio.feed_url("acme", Ask()) == "https://acme.jobs.personio.de/xml"
def test_additional_offices_are_places_of_the_role_each_once() -> None:
first = _rows()[0]
assert [p["text"] for p in first["places"]] == ["Remote - Germany", "Berlin", "Hamburg"]
assert [p["remote"] for p in first["places"]] == [True, None, None]
assert first["location"] == "Remote - Germany; Berlin; Hamburg"
assert "remote" not in first # the feed states none
assert _rows()[1]["places"] == [{"text": "Munich", "remote": None}]
def test_the_stated_level_and_employment_are_the_hosts_words() -> None:
rows = _rows()
assert [r["seniority"] for r in rows] == ["entry-level", "executive", "student"]
# permanent + full-time gives the schedule; a working student is the contract's word
assert [r["employment"] for r in rows] == ["full-time", "full-time", "working_student"]