Readers oracle to workday and the providers hand on the host's words; their word tables move to app/prep/hosts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a66aac95cf
commit
06eb929eaf
48 files changed
+460
-388
No files matched your search
@@ -4,17 +4,14 @@ 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"
|
||||
@@ -27,19 +24,18 @@ def _rows() -> list[dict]:
|
||||
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.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_the_country_is_stated_when_they_share_one() -> None:
|
||||
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 first["country"] is None # NL and BG
|
||||
assert "country" not in first # prep derives it from the places
|
||||
assert berlin["places"] == [{"text": "Berlin, Germany", "remote": None}]
|
||||
assert berlin["country"] == "DE"
|
||||
|
||||
|
||||
def test_remote_job_is_not_a_place() -> None:
|
||||
@@ -48,28 +44,16 @@ def test_remote_job_is_not_a_place() -> None:
|
||||
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())
|
||||
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}], {"PT"})
|
||||
assert recruitee._places(offer) == [{"text": "Lisbon, Portugal", "remote": None}]
|
||||
|
||||
|
||||
def test_the_stated_level_and_employment_are_mapped() -> None:
|
||||
def test_the_stated_level_and_employment_are_the_hosts_codes() -> 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'"]
|
||||
assert [r["seniority"] for r in rows] == ["experienced", "entry_level", "student_school"]
|
||||
assert [r["employment"] for r in rows] == [
|
||||
"fulltime_permanent", "parttime_permanent", "internship"]
|
||||
Reference in new issue
Block a user