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>
This commit is contained in:
1 parent
4c0da58da7
commit
4316624769
42 files changed
+3126
-199
No files matched your search
@@ -0,0 +1,92 @@
|
||||
"""SmartRecruiters: the place, country, level and employment a posting states.
|
||||
No network: the shapes are those of Bosch's board, read on 2026-09-30."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
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, smartrecruiters # noqa: E402
|
||||
|
||||
FIXTURES = ROOT / "tests" / "fixtures" / "ats"
|
||||
|
||||
|
||||
def _posting(**fields: object) -> dict:
|
||||
return {"id": "1", "name": "Engineer", "releasedDate": "2026-09-30T06:57:01.920Z",
|
||||
"location": {"city": "Hatvan", "country": "hu", "remote": False,
|
||||
"fullLocation": "Hatvan, , Hungary"}, **fields}
|
||||
|
||||
|
||||
def _rows(*postings: dict) -> list[dict]:
|
||||
return smartrecruiters.rows({"content": list(postings)}, "BoschGroup")
|
||||
|
||||
|
||||
def test_the_declaration_says_what_the_list_gives() -> None:
|
||||
reads = smartrecruiters.READS
|
||||
assert (reads.listing, reads.page_size, reads.places, reads.text, reads.empty) == \
|
||||
("paged", 100, "one", "none", "suspect")
|
||||
assert reads.fields.posted == "trusted" and reads.fields.seniority == "stated"
|
||||
assert reads.robots.startswith("api: no robots.txt check needed")
|
||||
|
||||
|
||||
def test_page_reads_by_offset_and_takes_the_ask() -> None:
|
||||
asked: list[str] = []
|
||||
|
||||
def get(url: str, **_: object) -> bytes:
|
||||
asked.append(url)
|
||||
return (FIXTURES / "smartrecruiters.json").read_bytes()
|
||||
|
||||
_data, results, total, cursor = smartrecruiters.page(get, "Acme", None, Ask())
|
||||
assert asked == ["https://api.smartrecruiters.com/v1/companies/Acme/postings"
|
||||
"?offset=0&limit=100"]
|
||||
assert (len(results), total, cursor) == (2, 3, 2)
|
||||
|
||||
|
||||
def test_the_place_is_one_clean_line_with_its_remote_flag_and_country() -> None:
|
||||
[row] = _rows(_posting())
|
||||
assert row["places"] == [{"text": "Hatvan, Hungary", "remote": False}] # ", ," gone
|
||||
assert row["location"] == "Hatvan, Hungary" and row["country"] == "HU"
|
||||
[remote] = _rows(_posting(location={"remote": True, "fullLocation": "Remote", "country": ""}))
|
||||
assert remote["places"] == [{"text": "Remote", "remote": True}] and remote["country"] is None
|
||||
[none] = _rows(_posting(location={}))
|
||||
assert none["places"] == [] and none["location"] == ""
|
||||
|
||||
|
||||
def test_the_stated_level_and_employment_are_mapped() -> None:
|
||||
[row] = _rows(_posting(experienceLevel={"id": "internship", "label": "Internship"},
|
||||
typeOfEmployment={"id": "intern", "label": "Intern"}))
|
||||
assert (row["seniority"], row["employment"]) == ("intern", "internship")
|
||||
levels = {"entry_level": "junior", "director": "director", "executive": "exec",
|
||||
"associate": None, "mid_senior_level": None, "not_applicable": None}
|
||||
for word, want in levels.items():
|
||||
[row] = _rows(_posting(experienceLevel={"id": word}))
|
||||
assert row["seniority"] == want, word
|
||||
[row] = _rows(_posting(typeOfEmployment={"id": "permanent"}))
|
||||
assert row["employment"] is None
|
||||
[row] = _rows(_posting())
|
||||
assert row["seniority"] is None and row["employment"] is None
|
||||
|
||||
|
||||
def test_the_table_speaks_the_apps_vocabulary_and_a_new_word_is_logged(
|
||||
caplog: pytest.LogCaptureFixture) -> None:
|
||||
assert {v for v in smartrecruiters._SENIORITY.values() if v} <= set(SENIORITIES)
|
||||
with caplog.at_level(logging.DEBUG, logger=smartrecruiters.__name__):
|
||||
[row] = _rows(_posting(experienceLevel={"id": "guru"}))
|
||||
assert row["seniority"] is None
|
||||
assert [r.getMessage() for r in caplog.records] == [
|
||||
"smartrecruiters: unknown experienceLevel 'guru'"]
|
||||
|
||||
|
||||
def test_the_saved_page_still_reads() -> None:
|
||||
data = json.loads((FIXTURES / "smartrecruiters.json").read_bytes())
|
||||
assert [r["location"] for r in smartrecruiters.rows(data, "Acme")] == ["Berlin, Germany",
|
||||
"Remote"]
|
||||
Reference in new issue
Block a user