Read Greenhouse, Lever, Ashby, Workable, SmartRecruiters, Recruitee and
Personio boards The `ats` plugin: one Source per host's public JSON (Personio: XML), each parsed to a common row and yielded as a `role` item. The field map, the redirect allow-list, the 8 MB cap and the 10 s timeout are ported from jobhunt-hq's openings.go (MIT); the nine-function classifier is ported from its seedgen. Workable, SmartRecruiters, Recruitee and Personio are new, written from one real board of each fetched while this was built. Fixtures under tests/fixtures/ats/ keep every test off the network. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ac5eca874a
commit
21ed472a87
10 files changed
+909
No files matched your search
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"jobs": [
|
||||
{
|
||||
"id": "3001",
|
||||
"title": "Product Designer",
|
||||
"department": "Design",
|
||||
"team": "Product",
|
||||
"location": "Munich",
|
||||
"isRemote": false,
|
||||
"publishedAt": "2026-09-01T00:00:00Z",
|
||||
"jobUrl": "https://ashby.example/1",
|
||||
"applyUrl": "https://ashby.example/1/apply",
|
||||
"descriptionHtml": "<p>Design our <strong>onboarding</strong> flow.</p>",
|
||||
"compensation": {"compensationTierSummary": "70,000-90,000 EUR"}
|
||||
},
|
||||
{
|
||||
"id": "3002",
|
||||
"title": "Enterprise Account Executive | Germany",
|
||||
"department": "Sales",
|
||||
"team": "Account Executives",
|
||||
"location": "Berlin",
|
||||
"isRemote": true,
|
||||
"publishedAt": "2026-08-28T21:20:40.792+00:00",
|
||||
"jobUrl": "https://ashby.example/2",
|
||||
"descriptionHtml": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"jobs": [
|
||||
{
|
||||
"id": 1001,
|
||||
"title": "\t Senior Backend Engineer ",
|
||||
"location": {"name": " Berlin, Germany"},
|
||||
"absolute_url": "https://gh.example/1",
|
||||
"updated_at": "2026-09-10T12:00:00-04:00",
|
||||
"first_published": "2026-09-09T08:00:00-04:00",
|
||||
"departments": [{"id": 1, "name": "Engineering"}],
|
||||
"content": "<p>Build our <strong>core platform</strong>.</p>"
|
||||
},
|
||||
{
|
||||
"id": 1002,
|
||||
"title": "Account Executive",
|
||||
"location": {"name": "Phoenix, AZ"},
|
||||
"absolute_url": "https://gh.example/2",
|
||||
"updated_at": "2026-09-11T12:00:00-04:00",
|
||||
"departments": [{"id": 2, "name": "Sales"}],
|
||||
"content": ""
|
||||
},
|
||||
{
|
||||
"id": 1003,
|
||||
"title": "Evil posting",
|
||||
"location": {"name": "Anywhere"},
|
||||
"absolute_url": "javascript:alert(1)",
|
||||
"departments": []
|
||||
},
|
||||
{
|
||||
"id": 1004,
|
||||
"title": "Data posting",
|
||||
"location": {"name": "Anywhere"},
|
||||
"absolute_url": "data:text/html,hi",
|
||||
"departments": []
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
[
|
||||
{
|
||||
"id": "2001",
|
||||
"text": "Staff Engineer, Platform",
|
||||
"hostedUrl": "https://lever.example/1",
|
||||
"createdAt": 1789430400000,
|
||||
"categories": {"location": "Remote", "department": "Engineering", "team": "Platform"},
|
||||
"workplaceType": "remote",
|
||||
"description": "<p>Own our <b>platform</b> reliability.</p>"
|
||||
},
|
||||
{
|
||||
"id": "2002",
|
||||
"text": "Customer Success Manager",
|
||||
"hostedUrl": "https://lever.example/2",
|
||||
"createdAt": 0,
|
||||
"categories": {"location": "New York", "department": "Customer Success"},
|
||||
"workplaceType": "on-site",
|
||||
"description": ""
|
||||
}
|
||||
]
|
||||
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<workzag-jobs>
|
||||
|
||||
<position>
|
||||
<id>6001</id>
|
||||
<subcompany>Acme AG</subcompany>
|
||||
<office>Remote - Germany</office>
|
||||
<department>Sales</department>
|
||||
<recruitingCategory>Customer Success</recruitingCategory>
|
||||
<name>Business Development Representative</name>
|
||||
<jobDescriptions>
|
||||
<jobDescription>
|
||||
<name>Your mission</name>
|
||||
<value><![CDATA[<p>Grow our pipeline.</p>]]></value>
|
||||
</jobDescription>
|
||||
</jobDescriptions>
|
||||
<employmentType>permanent</employmentType>
|
||||
<seniority>entry-level</seniority>
|
||||
<schedule>full-time</schedule>
|
||||
<createdAt>2026-08-19T10:04:22+00:00</createdAt>
|
||||
</position>
|
||||
|
||||
<position>
|
||||
<id>6002</id>
|
||||
<subcompany>Acme AG</subcompany>
|
||||
<office>Munich</office>
|
||||
<department>Engineering</department>
|
||||
<name>Backend Engineer (all genders)</name>
|
||||
<jobDescriptions></jobDescriptions>
|
||||
<employmentType>permanent</employmentType>
|
||||
<seniority>experienced</seniority>
|
||||
<schedule>full-time</schedule>
|
||||
<createdAt>2026-09-21T14:53:35+00:00</createdAt>
|
||||
</position>
|
||||
|
||||
</workzag-jobs>
|
||||
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"offers": [
|
||||
{
|
||||
"id": 5001,
|
||||
"title": "Player Support Agent (German)",
|
||||
"slug": "player-support-agent-german-1",
|
||||
"careers_url": "https://acme.example/o/player-support-agent-german-1",
|
||||
"department": "Player Support",
|
||||
"city": "Berlin",
|
||||
"location": "Berlin",
|
||||
"remote": true,
|
||||
"on_site": false,
|
||||
"published_at": "2026-09-23 04:36:48 UTC",
|
||||
"created_at": "2026-09-20 04:27:06 UTC",
|
||||
"description": "<p>Support our <b>players</b>.</p>",
|
||||
"salary": {"min": 35000, "max": 45000, "currency": "EUR", "period": "year"}
|
||||
},
|
||||
{
|
||||
"id": 5002,
|
||||
"title": "Finance Manager",
|
||||
"slug": "finance-manager",
|
||||
"careers_url": "https://acme.example/o/finance-manager",
|
||||
"department": "Finance",
|
||||
"city": "Munich",
|
||||
"location": "Munich",
|
||||
"remote": false,
|
||||
"published_at": "2026-09-01 00:00:00 UTC",
|
||||
"description": "",
|
||||
"salary": {"min": null, "max": null, "currency": null, "period": null}
|
||||
}
|
||||
]
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"offset": 0,
|
||||
"limit": 100,
|
||||
"totalFound": 2,
|
||||
"content": [
|
||||
{
|
||||
"id": "744000151326819",
|
||||
"name": "Dir, Software Engrg Mgmt",
|
||||
"company": {"identifier": "Acme", "name": "Acme"},
|
||||
"releasedDate": "2026-09-23T08:47:37.279Z",
|
||||
"location": {
|
||||
"city": "Berlin",
|
||||
"country": "de",
|
||||
"remote": false,
|
||||
"hybrid": false,
|
||||
"fullLocation": "Berlin, Germany"
|
||||
},
|
||||
"department": {"id": "2294038", "label": "Engineering, Infrastructure and Operations"},
|
||||
"function": {"id": "engineering", "label": "Engineering"}
|
||||
},
|
||||
{
|
||||
"id": "744000147485112",
|
||||
"name": "Sales Enablement Manager",
|
||||
"company": {"identifier": "Acme", "name": "Acme"},
|
||||
"releasedDate": "2026-09-10T09:00:00.000Z",
|
||||
"location": {"city": "", "country": "", "remote": true, "fullLocation": "Remote"},
|
||||
"department": {"id": "1", "label": "Sales"},
|
||||
"function": {"id": "sales", "label": "Sales"}
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"total": 2,
|
||||
"results": [
|
||||
{
|
||||
"id": "4001",
|
||||
"title": "Backend Engineer",
|
||||
"department": "Engineering",
|
||||
"city": "Berlin",
|
||||
"region": "",
|
||||
"country": "Germany",
|
||||
"telecommute": true,
|
||||
"published_on": "2026-09-01",
|
||||
"created_at": "2026-08-30T10:00:00.000Z",
|
||||
"url": "https://workable.example/1",
|
||||
"shortlink": "https://workable.example/short/1",
|
||||
"description": "<p>Ship our API.</p>",
|
||||
"requirements": "<p>5+ years.</p>",
|
||||
"benefits": ""
|
||||
},
|
||||
{
|
||||
"id": "4002",
|
||||
"shortcode": "ABCDEF",
|
||||
"title": "Account Manager",
|
||||
"department": "Sales",
|
||||
"city": "Munich",
|
||||
"region": "",
|
||||
"country": "Germany",
|
||||
"telecommute": false,
|
||||
"published_on": "2026-08-15",
|
||||
"url": "https://workable.example/2",
|
||||
"description": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
"""The `ats` plugin: each host's parser against a saved feed, the function
|
||||
classifier, and the fetch allow-list. No network — every fixture is a file
|
||||
under `tests/fixtures/ats/`."""
|
||||
|
||||
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 import ats # noqa: E402
|
||||
|
||||
FIXTURES = ROOT / "tests" / "fixtures" / "ats"
|
||||
|
||||
|
||||
def _rows(host: str, slug: str = "acme") -> list[ats.Row]:
|
||||
path = FIXTURES / f"{host}.{'xml' if host == 'personio' else 'json'}"
|
||||
body = path.read_bytes()
|
||||
return ats._PARSERS[host](body, slug)
|
||||
|
||||
|
||||
# ------------------------------------------------------------------ hosts
|
||||
|
||||
def test_greenhouse_parses_titles_locations_and_html_description() -> None:
|
||||
rows = _rows("greenhouse")
|
||||
# The javascript: and data: rows are refused, same as the two real ones
|
||||
# are kept: a feed is external content, never trusted as a URL.
|
||||
assert [r["source_id"] for r in rows] == ["1001", "1002"]
|
||||
first = rows[0]
|
||||
assert first["title"] == "Senior Backend Engineer" # trimmed
|
||||
assert first["location"] == "Berlin, Germany"
|
||||
assert first["department"] == "Engineering"
|
||||
assert first["description"] == "Build our core platform."
|
||||
assert first["posted"] is not None and first["posted"].year == 2026
|
||||
assert first["remote"] is None
|
||||
|
||||
|
||||
def test_lever_parses_categories_and_workplace_type() -> None:
|
||||
rows = _rows("lever")
|
||||
assert [r["source_id"] for r in rows] == ["2001", "2002"]
|
||||
first = rows[0]
|
||||
assert first["department"] == "Engineering"
|
||||
assert first["remote"] == "remote"
|
||||
assert first["description"] == "Own our platform reliability."
|
||||
# createdAt=0 means "no date", not epoch zero.
|
||||
assert rows[1]["posted"] is None
|
||||
|
||||
|
||||
def test_ashby_parses_is_remote_and_compensation() -> None:
|
||||
rows = _rows("ashby")
|
||||
assert [r["source_id"] for r in rows] == ["3001", "3002"]
|
||||
assert rows[0]["remote"] is False
|
||||
assert rows[0]["salary"] == "70,000-90,000 EUR"
|
||||
assert rows[1]["remote"] is True
|
||||
|
||||
|
||||
def test_workable_parses_location_parts_and_telecommute() -> None:
|
||||
rows = _rows("workable")
|
||||
assert [r["source_id"] for r in rows] == ["4001", "4002"]
|
||||
assert rows[0]["location"] == "Berlin, Germany"
|
||||
assert rows[0]["remote"] is True
|
||||
assert "Ship our API." in rows[0]["description"]
|
||||
|
||||
|
||||
def test_smartrecruiters_builds_the_job_url_from_id_and_slug() -> None:
|
||||
rows = _rows("smartrecruiters", slug="Acme")
|
||||
assert [r["source_id"] for r in rows] == ["744000151326819", "744000147485112"]
|
||||
assert rows[0]["url"] == "https://jobs.smartrecruiters.com/Acme/744000151326819"
|
||||
assert rows[0]["location"] == "Berlin, Germany"
|
||||
assert rows[1]["remote"] is True
|
||||
|
||||
|
||||
def test_recruitee_parses_salary_bounds_and_careers_url() -> None:
|
||||
rows = _rows("recruitee")
|
||||
assert [r["source_id"] for r in rows] == ["5001", "5002"]
|
||||
assert rows[0]["url"] == "https://acme.example/o/player-support-agent-german-1"
|
||||
assert rows[0]["salary"] == "35000-45000 EUR"
|
||||
assert rows[1]["salary"] == ""
|
||||
|
||||
|
||||
def test_personio_builds_the_job_url_and_reads_cdata_description() -> None:
|
||||
rows = _rows("personio", slug="acme")
|
||||
assert [r["source_id"] for r in rows] == ["6001", "6002"]
|
||||
assert rows[0]["url"] == "https://acme.jobs.personio.de/job/6001"
|
||||
assert rows[0]["description"] == "Grow our pipeline."
|
||||
assert rows[0]["remote"] is True # "Remote - Germany"
|
||||
assert rows[1]["remote"] is None # "Munich"
|
||||
|
||||
|
||||
# --------------------------------------------------------------- classify
|
||||
|
||||
def test_classify_matches_department_before_title() -> None:
|
||||
assert ats.classify("Engineering", "Marketing Lead") == "engineering"
|
||||
assert ats.classify("", "Senior Backend Engineer") == "engineering"
|
||||
assert ats.classify("", "Product Manager, Payments") == "product"
|
||||
assert ats.classify("", "Data Product Manager") == "product"
|
||||
assert ats.classify("", "Machine Learning Engineer") == "data"
|
||||
assert ats.classify("", "Executive Assistant to the CEO") == "finance/legal/ops"
|
||||
assert ats.classify("", "") == "other"
|
||||
|
||||
|
||||
# ------------------------------------------------------------- allow-list
|
||||
|
||||
def test_is_known_target_accepts_the_seven_hosts_and_refuses_others() -> None:
|
||||
for host in ("greenhouse", "lever", "ashby", "workable", "smartrecruiters",
|
||||
"recruitee", "personio"):
|
||||
assert ats.is_known_target(f"{host}:acme")
|
||||
assert not ats.is_known_target("linkedin:acme")
|
||||
assert not ats.is_known_target("workday:acme")
|
||||
assert not ats.is_known_target("greenhouse:")
|
||||
assert not ats.is_known_target("nohostnoseparator")
|
||||
|
||||
|
||||
def test_allowed_host_refuses_a_foreign_host_per_board() -> None:
|
||||
allow = ats._allowed_host("greenhouse", "acme")
|
||||
assert allow("boards-api.greenhouse.io")
|
||||
assert not allow("boards-api.greenhouse.io.evil.example")
|
||||
assert not allow("api.lever.co")
|
||||
|
||||
# recruitee and personio key off the company's own subdomain, so one
|
||||
# company's slug must not pass for another's.
|
||||
allow_recruitee = ats._allowed_host("recruitee", "acme")
|
||||
assert allow_recruitee("acme.recruitee.com")
|
||||
assert not allow_recruitee("other.recruitee.com")
|
||||
|
||||
|
||||
def test_careers_url_is_filled_per_host_and_empty_for_unknown() -> None:
|
||||
assert ats.careers_url("greenhouse:acme") == "https://job-boards.greenhouse.io/acme"
|
||||
assert ats.careers_url("ashby:acme") == "https://jobs.ashbyhq.com/acme"
|
||||
assert ats.careers_url("recruitee:acme") == "https://acme.recruitee.com"
|
||||
assert ats.careers_url("workday:acme") == ""
|
||||
Reference in new issue
Block a user