From eac483ff1354e1e4b7c1334527cd6b832cec1de3 Mon Sep 17 00:00:00 2001
From: Wolf We are constantly seeking talented individuals to join our team. If you are a Software Engineer and haven\u2019t found the perfect role on our careers page, don\u2019t worry \u2014 you\u2019ve come to the right place. We strongly believe that each person has something unique to bring to the table. Whether you\u2019re a recent graduate or a seasoned professional, we\u2019re genuinely excited to hear from you. At Prisma, we work with modern technologies, including TypeScript",
+ "role": " You're likely to be a great fit for the team if you ...Not finding the perfect engineering role on our careers page?
What is it like to work at Prisma?
Rippling gives businesses one place to run HR, IT, and Finance. It brings together all of the workforce systems that are normally scattered across a company, like payroll, expenses, benefits, and computers. For the first time ever, you can manage and automate every part of the employee lifecycle in a single system.
Take onboarding, for example. With Rippling, you can hire a new employee anywhere in the world and set up their payroll, corporate card, computer, benefits, and even third-party apps like Slack and Microsoft 365\u2014all within 90 seconds.", + "role": "
Rippling Infrastructure operates as a scaled engineering organization responsible for the mission-critical systems that power every product and platform across the company. We support nearly 1,000 engineers globally and deliver the foundational infrastructure that enables Rippling's products to scale reliably and efficiently.
" + }, + "workLocations": [ + "San Francisco, CA", + "Seattle, WA", + "New York, NY" + ], + "department": { + "name": "Platform", + "base_department": "Engineering", + "department_tree": [ + "Engineering", + "Platform" + ] + }, + "employmentType": { + "label": "SALARIED_FT", + "id": "Salaried, full-time" + }, + "createdOn": "2025-04-07T12:29:19.348000-07:00", + "eeocQuestionnaireEnabled": true, + "eeocQuestionnaireEnabledForJobPost": true, + "url": "https://ats.rippling.com/rippling/jobs/2f2ae4c8-ec56-4d1f-8f2a-0d295674e19c", + "board": { + "boardType": "CUSTOM", + "slug": "rippling", + "banner": null, + "title": "Current Openings", + "subtitle": null, + "boardURL": "http://www.rippling.com/careers/open-roles", + "fontType": null, + "linkColor": null, + "buttonColor": null, + "buttonTextColor": null, + "noOpeningsMessage": null, + "groupJobsByLocation": false, + "showBoardLogoOnJobPost": false, + "showCompanyInfoUnderJobPost": false, + "companyName": "Rippling" + }, + "payRangeDetails": [ + { + "location": "US Tier 1", + "currency": "USD", + "frequency": "YEAR", + "rangeStart": 216000.0, + "rangeEnd": 378000.0, + "isRemote": false + } + ], + "applicationConfirmationTemplate": "6348729c5a9a6e6df0bb6f64", + "hasAIEvaluationsEnabled": true, + "companyName": "Rippling", + "unlistedFromSearch": false, + "jsonLd": null +} diff --git a/tests/fixtures/ats/rippling.json b/tests/fixtures/ats/rippling.json new file mode 100644 index 0000000..893505d --- /dev/null +++ b/tests/fixtures/ats/rippling.json @@ -0,0 +1,106 @@ +[ + { + "uuid": "75ad50c6-778f-42ee-9c63-70d1cd687202", + "name": "Account Executive, Broker Channel (Austin & San Antonio)", + "department": { + "id": "Sales", + "label": "Sales" + }, + "url": "https://ats.rippling.com/rippling/jobs/75ad50c6-778f-42ee-9c63-70d1cd687202", + "workLocation": { + "label": "Austin, TX", + "id": "Austin, TX" + } + }, + { + "uuid": "94486f41-6474-446a-b67a-c164e11354ea", + "name": "Account Executive, Broker Channel (Pittsburgh or Cleveland)", + "department": { + "id": "Sales", + "label": "Sales" + }, + "url": "https://ats.rippling.com/rippling/jobs/94486f41-6474-446a-b67a-c164e11354ea", + "workLocation": { + "label": "Pittsburgh, PA", + "id": "Pittsburgh, PA" + } + }, + { + "uuid": "94486f41-6474-446a-b67a-c164e11354ea", + "name": "Account Executive, Broker Channel (Pittsburgh or Cleveland)", + "department": { + "id": "Sales", + "label": "Sales" + }, + "url": "https://ats.rippling.com/rippling/jobs/94486f41-6474-446a-b67a-c164e11354ea", + "workLocation": { + "label": "Cleveland, OH", + "id": "Cleveland, OH" + } + }, + { + "uuid": "2f2ae4c8-ec56-4d1f-8f2a-0d295674e19c", + "name": "Director of Engineering - Infrastructure", + "department": { + "id": "Engineering", + "label": "Engineering" + }, + "url": "https://ats.rippling.com/rippling/jobs/2f2ae4c8-ec56-4d1f-8f2a-0d295674e19c", + "workLocation": { + "label": "San Francisco, CA", + "id": "San Francisco, CA" + } + }, + { + "uuid": "2f2ae4c8-ec56-4d1f-8f2a-0d295674e19c", + "name": "Director of Engineering - Infrastructure", + "department": { + "id": "Engineering", + "label": "Engineering" + }, + "url": "https://ats.rippling.com/rippling/jobs/2f2ae4c8-ec56-4d1f-8f2a-0d295674e19c", + "workLocation": { + "label": "Seattle, WA", + "id": "Seattle, WA" + } + }, + { + "uuid": "2f2ae4c8-ec56-4d1f-8f2a-0d295674e19c", + "name": "Director of Engineering - Infrastructure", + "department": { + "id": "Engineering", + "label": "Engineering" + }, + "url": "https://ats.rippling.com/rippling/jobs/2f2ae4c8-ec56-4d1f-8f2a-0d295674e19c", + "workLocation": { + "label": "New York, NY", + "id": "New York, NY" + } + }, + { + "uuid": "46b4af52-824b-4803-be84-e8ed57bd33a1", + "name": "Account Executive, Private Equity", + "department": { + "id": "Sales", + "label": "Sales" + }, + "url": "https://ats.rippling.com/rippling/jobs/46b4af52-824b-4803-be84-e8ed57bd33a1", + "workLocation": { + "label": "Remote (United States)", + "id": "Remote (United States)" + } + }, + { + "uuid": "19ae5b34-e7b7-4164-99d4-fc8f84bb37fe", + "name": "Accounting Manager, PEO Compliance", + "department": { + "id": "Finance", + "label": "Finance" + }, + "url": "https://ats.rippling.com/rippling/jobs/19ae5b34-e7b7-4164-99d4-fc8f84bb37fe", + "workLocation": { + "label": "Remote (United States)", + "id": "Remote (United States)" + } + } +] diff --git a/tests/test_ats_rippling.py b/tests/test_ats_rippling.py new file mode 100644 index 0000000..a60780f --- /dev/null +++ b/tests/test_ats_rippling.py @@ -0,0 +1,212 @@ +"""The Rippling host module against saved answers: a listing trimmed from +Rippling's own board, Prisma's whole listing, and two role records, +2026-09-29. No network.""" + +from __future__ import annotations + +import json +import sys +from pathlib import Path +from typing import Any + +import httpx +import pytest + +ROOT = Path(__file__).resolve().parents[1] +if str(ROOT) not in sys.path: + sys.path.insert(0, str(ROOT)) + +from app.jobs.discover import boards_in # noqa: E402 +from plugins import ats, atshosts # noqa: E402 +from plugins.atshosts import rippling # noqa: E402 + +FIXTURES = ROOT / "tests" / "fixtures" / "ats" +BOARD = (FIXTURES / "rippling.json").read_bytes() +PRISMA = (FIXTURES / "rippling-prisma.json").read_bytes() +FEED = "https://api.rippling.com/platform/api/ats/v1/board/rippling/jobs" +DIRECTOR = "2f2ae4c8-ec56-4d1f-8f2a-0d295674e19c" + + +def test_rows_merge_one_entry_per_place_into_one_role() -> None: + rows = rippling.parse(BOARD, "rippling") + assert [r["source_id"][:8] for r in rows] == [ + "75ad50c6", "94486f41", "2f2ae4c8", "46b4af52", "19ae5b34"] + by_id = {r["source_id"][:8]: r for r in rows} + assert by_id["94486f41"]["location"] == "Pittsburgh, PA; Cleveland, OH" + assert by_id["2f2ae4c8"]["location"] == "San Francisco, CA; Seattle, WA; New York, NY" + first = rows[0] + assert first["title"] == "Account Executive, Broker Channel (Austin & San Antonio)" + assert first["url"] == "https://ats.rippling.com/rippling/jobs/75ad50c6-778f-42ee-9c63-70d1cd687202" + assert first["department"] == "Sales" and first["location"] == "Austin, TX" + assert first["description"] == "" and first["salary_text"] == "" and first["posted"] is None + + +def test_remote_is_true_only_when_every_place_is_a_remote_one() -> None: + by_id = {r["source_id"][:8]: r for r in rippling.parse(BOARD, "rippling")} + assert by_id["46b4af52"]["remote"] is True and by_id["19ae5b34"]["remote"] is True + assert by_id["75ad50c6"]["remote"] is None # an office label says nothing either way + mixed = json.dumps([ + {"uuid": "abcdefgh-1", "name": "A", "workLocation": {"label": "Remote (Germany)"}}, + {"uuid": "abcdefgh-1", "name": "A", "workLocation": {"label": "Berlin"}}]).encode() + assert rippling.parse(mixed, "x")[0]["remote"] is None + + +def test_prisma_board_reads_two_roles() -> None: + rows = rippling.parse(PRISMA, "prisma-careers") + assert [(r["title"], r["department"], r["location"], r["remote"]) for r in rows] == [ + ("General Applications: Engineering", "Engineering", "Remote (Germany)", True), + ("General Applications: Product", "Product", "Remote (Germany)", True)] + + +def test_an_empty_board_is_no_roles_and_an_error_answer_is_not_a_board() -> None: + assert rippling.parse(b"[]", "acme") == [] + with pytest.raises(ValueError, match="not a Rippling board"): + rippling.parse(b'{"error_code":"RESOURCE_NOT_FOUND"}', "acme") + + +def test_an_entry_without_a_title_or_a_plain_id_is_skipped() -> None: + body = json.dumps([{"uuid": "abcdefgh-1", "name": " "}, {"name": "B"}, + {"uuid": "../../x", "name": "C"}, + {"uuid": "abcdefgh-2", "name": "D"}]).encode() + assert [r["source_id"] for r in rippling.parse(body, "acme")] == ["abcdefgh-2"] + + +# ---------------------------------------------------------------- detail + +def _get(answer: bytes, asked: list[str] | None = None) -> Any: + def get(url: str, *, method: str = "GET", payload: Any = None, + headers: dict[str, str] | None = None) -> bytes: + if asked is not None: + asked.append(url) + return answer + return get + + +def test_detail_reads_description_places_date_and_a_single_yearly_range() -> None: + row = {r["source_id"]: r for r in rippling.parse(BOARD, "rippling")}[DIRECTOR] + asked: list[str] = [] + found = rippling.detail(_get((FIXTURES / "rippling-role.json").read_bytes(), asked), + "rippling", row) + assert asked == [f"https://api.rippling.com/platform/api/ats/v1/board/rippling/jobs/{DIRECTOR}"] + assert set(found) <= set(ats.DETAIL_FIELDS) + assert found["description"].startswith("About The Role") + assert "<" not in found["description"] + assert found["location"] == "San Francisco, CA; Seattle, WA; New York, NY" + assert found["posted"] is not None and found["posted"].isoformat() == \ + "2025-04-07T12:29:19.348000-07:00" + assert (found["salary_min"], found["salary_max"], found["currency"]) == (216000, 378000, "USD") + + +def test_detail_without_pay_leaves_the_pay_columns_out() -> None: + found = rippling.detail(_get((FIXTURES / "rippling-role-2.json").read_bytes()), + "prisma-careers", {"source_id": "x"}) + assert found["description"].startswith("What is it like to work at Prisma?") + assert found["location"] == "Remote (Germany)" + assert not {"salary_min", "salary_max", "currency"} & set(found) + + +@pytest.mark.parametrize("ranges", [ + [], + [{"currency": "USD", "frequency": "HOUR", "rangeStart": 40, "rangeEnd": 60}], + [{"currency": "USD", "frequency": "YEAR", "rangeStart": 1, "rangeEnd": 2}, + {"currency": "USD", "frequency": "YEAR", "rangeStart": 3, "rangeEnd": 4}], # several zones + [{"currency": "", "frequency": "YEAR", "rangeStart": 1, "rangeEnd": 2}], +]) +def test_only_one_yearly_range_with_a_currency_fills_the_columns(ranges: list[Any]) -> None: + body = json.dumps({"description": {"role": "x
"}, "payRangeDetails": ranges}).encode() + found = rippling.detail(_get(body), "acme", {"source_id": "x"}) + assert not {"salary_min", "salary_max", "currency"} & set(found) + assert found["description"] == "x" and found["posted"] is None + + +def test_a_monthly_range_is_made_yearly_and_the_company_text_stands_in_for_a_missing_role_text( +) -> None: + body = json.dumps({"description": {"company": "About us & more
", "role": ""}, + "payRangeDetails": [{"currency": "EUR", "frequency": "MONTH", + "rangeStart": 3000, "rangeEnd": None}]}).encode() + found = rippling.detail(_get(body), "acme", {"source_id": "x"}) + assert found["description"] == "About us & more" + assert (found["salary_min"], found["salary_max"], found["currency"]) == (36000, None, "EUR") + + +@pytest.fixture +def web(monkeypatch: pytest.MonkeyPatch) -> dict[str, Any]: + answers: dict[str, Any] = {} + asked: list[str] = [] + + def fake_get(client, url, host, slug, *, method="GET", payload=None, headers=None, + www_twin=False): + asked.append(url) + if not ats._allowed_host(host, slug)(httpx.URL(url).host): + raise ats._Refused(url) + answer = answers[url] + if isinstance(answer, BaseException): + raise answer + return answer + + monkeypatch.setattr(ats, "_get", fake_get) + return {"answers": answers, "asked": asked} + + +def test_the_board_is_one_request_and_complete(web: dict[str, Any]) -> None: + web["answers"][FEED] = BOARD + with httpx.Client() as client: + rows, complete = ats._fetch_rows(client, "rippling:rippling") + assert len(rows) == 5 and complete and web["asked"] == [FEED] + + +def test_robots_are_read_from_the_site_and_disallow_only_internal( + web: dict[str, Any]) -> None: + web["answers"]["https://ats.rippling.com/robots.txt"] = b"User-agent: *\nDisallow: /internal/\n" + with httpx.Client() as client: + ats._check_robots(client, "rippling:prisma-careers") + web["answers"]["https://ats.rippling.com/robots.txt"] = b"User-agent: *\nDisallow: /\n" + with pytest.raises(ats._Disallowed): + ats._check_robots(client, "rippling:prisma-careers") + + +# ------------------------------------------------------- slugs and hosts + +def test_the_module_is_registered_as_a_feed_host_with_detail() -> None: + assert atshosts.HOSTS["rippling"] is rippling and ats.HOSTS["rippling"] == "Rippling" + assert rippling.NAME == "rippling" and rippling.KEEP_CASE + assert hasattr(rippling, "detail") and not hasattr(rippling, "page") + + +def test_the_urls_and_the_robots_page() -> None: + assert rippling.feed_url("rippling") == FEED + assert rippling.careers_url("prisma-careers") == "https://ats.rippling.com/prisma-careers/jobs" + assert rippling.robots_page("prisma-careers") == rippling.careers_url("prisma-careers") + allow = rippling.allowed("rippling") + assert allow("api.rippling.com") and allow("ATS.RIPPLING.COM") + for host in ("rippling.com", "www.rippling.com", "api.rippling.com.evil.example", "localhost"): + assert not allow(host) + + +@pytest.mark.parametrize("slug", ["rippling", "prisma-careers", "Acme_2", "9x"]) +def test_a_slug_is_one_path_segment(slug: str) -> None: + assert ats.is_known_target(f"rippling:{slug}") + + +@pytest.mark.parametrize("slug", [ + "", "a@b", "a#b", "a?b", "..", ".", "a%2fb", "%2f", "a/b", "a:443", "a b", "acme\n", + " acme", "acme ", "127.0.0.1", "a.b", "_x", "-x", "a\\b", "évil", +]) +def test_a_hostile_slug_is_refused(slug: str) -> None: + assert not rippling.slug_ok(slug) + assert not ats.is_known_target(f"rippling:{slug}") + + +def test_no_slug_reaches_another_host() -> None: + for slug in ("rippling", "Prisma-Careers", "a-b_c"): + for url in (rippling.feed_url(slug), rippling.careers_url(slug), + rippling.robots_page(slug)): + assert httpx.URL(url).host in ("api.rippling.com", "ats.rippling.com") + + +def test_discovery_finds_the_board_slug() -> None: + page = ('Jobs' + 'Role' + '') + assert [(h, s) for h, s, _ in boards_in(page)] == [ + ("rippling", "prisma-careers"), ("rippling", "Acme"), ("rippling", "beta")]