Files
jobboard/tests/test_ats_recruitee.py
T
WolfandClaude Opus 5.5 4316624769 Declare READS for Oracle, Personio, Phenom, Pinpoint, Recruitee, Rippling, SmartRecruiters, SuccessFactors, Teamtailor, Workable and Workday
Every row carries places (Personio additionalOffices, Workable and Recruitee
locations[], every SuccessFactors address, Workday's own read), the list
teaser of Phenom and Oracle is kept in teaser, and the level, employment and
country a host states are mapped. Workday "N Locations" and "Country - City",
and Recruitee "Remote job", are no longer places. Phenom takes dateCreated
as posted. robots_page and ROBOTS_ANY_CASE go; READS.robots records the
decision. Signatures are feed_url(slug, ask) and page(get, slug, cursor, ask),
with an empty Ask as the default so the runner of today still calls them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 09:14:27 +02:00

76 lines
3.1 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 logging
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from app.models import SENIORITIES # noqa: E402
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 == "stated"
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_the_country_is_stated_when_they_share_one() -> 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 first["country"] is None # NL and BG
assert berlin["places"] == [{"text": "Berlin, Germany", "remote": None}]
assert berlin["country"] == "DE"
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) == ([], set())
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}], {"PT"})
def test_the_stated_level_and_employment_are_mapped() -> None:
rows = _rows()
assert [r["seniority"] for r in rows] == [None, "junior", "intern"]
assert [r["employment"] for r in rows] == ["full_time", "part_time", "internship"]
assert recruitee._employment("fulltime_fixed_term") == "temporary"
assert recruitee._employment("freelance") == "contract"
def test_the_table_speaks_the_apps_vocabulary_and_a_new_word_is_logged(
caplog: pytest.LogCaptureFixture) -> None:
assert {v for v in recruitee._SENIORITY.values() if v} <= set(SENIORITIES)
with caplog.at_level(logging.DEBUG, logger=recruitee.__name__):
assert recruitee._seniority("senior_level") is None
assert recruitee._employment("odd_job") is None
assert [r.getMessage() for r in caplog.records] == [
"recruitee: unknown experience_code 'senior_level'",
"recruitee: unknown employment_type_code 'odd_job'"]