From 76187d586280be162c24711bb6c1315f2f51a04e Mon Sep 17 00:00:00 2001 From: Wolf Date: Tue, 29 Sep 2026 20:02:45 +0200 Subject: [PATCH] Read BambooHR boards from their careers list and role pages Co-Authored-By: Claude Sonnet 5.5 --- plugins/atshosts/bamboohr.py | 135 +++++++++++++++ tests/fixtures/ats/bamboohr-detail-26.json | 1 + tests/fixtures/ats/bamboohr-detail-37.json | 1 + tests/fixtures/ats/bamboohr.json | 1 + tests/test_ats_bamboohr.py | 185 +++++++++++++++++++++ 5 files changed, 323 insertions(+) create mode 100644 plugins/atshosts/bamboohr.py create mode 100644 tests/fixtures/ats/bamboohr-detail-26.json create mode 100644 tests/fixtures/ats/bamboohr-detail-37.json create mode 100644 tests/fixtures/ats/bamboohr.json create mode 100644 tests/test_ats_bamboohr.py diff --git a/plugins/atshosts/bamboohr.py b/plugins/atshosts/bamboohr.py new file mode 100644 index 0000000..0a558a2 --- /dev/null +++ b/plugins/atshosts/bamboohr.py @@ -0,0 +1,135 @@ +"""BambooHR: `bamboohr:` for acme.bamboohr.com, the whole board in +one JSON answer and each role's text, date and country on its own page. + +Written from Configit's board on 2026-09-29 (two roles); jobhunt-hq did not +read BambooHR. Unverified: whether a large board pages `/careers/list` (this +one states `meta.totalCount` and no paging keys, so a list shorter than its +count is refused rather than read as the whole board), and the words of +`locationType`, taken to be BambooHR's own settings, "0" in the office, "1" +remote and "2" hybrid; Configit's hybrid roles say "2" and `isRemote` is null. + +A posting that invites an unsolicited application without a role (Configit's +first) is listed like any other role. +""" + +from __future__ import annotations + +import html +import json +from collections.abc import Callable +from typing import Any + +from desk.sources import strip_html + +from ._shared import Get, Row, label_slug_ok, only, parse_dt + +NAME = "bamboohr" +LABEL = "BambooHR" +PATTERNS = ( + # Not the company's own app or documentation subdomains, which BambooHR + # itself serves and which name no board. + r"https?://(?!(?:app|resources|documentation|help)\.)([a-z0-9-]+)\.bamboohr\.com", +) + +#: `locationType` -> `store._remote`'s words. Anything else says nothing. +_REMOTE = {"0": "onsite", "1": "remote", "2": "hybrid"} + +#: Sent on the detail read: without it the same URL answers the page's HTML. +_JSON = {"Accept": "application/json"} + + +def host(slug: str) -> str: + return f"{slug.lower()}.bamboohr.com" + + +def slug_ok(slug: str) -> bool: + return label_slug_ok(slug) + + +def allowed(slug: str) -> Callable[[str], bool]: + return only(host(slug)) + + +def careers_url(slug: str) -> str: + return f"https://{host(slug)}/careers" + + +def robots_page(slug: str) -> str: + return careers_url(slug) + + +def feed_url(slug: str) -> str: + return f"https://{host(slug)}/careers/list" + + +def _remote(j: dict[str, Any]) -> str | None: + if j.get("isRemote") is True: + return "remote" + return _REMOTE.get(str(j.get("locationType") if j.get("locationType") is not None else "")) + + +def _place(j: dict[str, Any]) -> str: + """City, state and country of a role, as far as either of its two + location objects states them (`atsLocation` mirrors `location` and is + filled by companies that use BambooHR's own applicant tracking).""" + place, ats_place = j.get("location") or {}, j.get("atsLocation") or {} + country = place.get("addressCountry") or ats_place.get("country") + parts = (place.get("city") or ats_place.get("city"), + place.get("state") or ats_place.get("state"), country) + return ", ".join(str(p).strip() for p in parts if p and str(p).strip()) + + +def parse(body: bytes, slug: str) -> list[Row]: + """`/careers/list` -> `{"meta": {"totalCount": n}, "result": [...]}`. A + role has `id`, `jobOpeningName`, `departmentLabel`, `location` (`city`, + `state`), `atsLocation` (the same with a `country`, null so far), + `isRemote` and `locationType`. The text, the date and the country are only + on the role's own page (`detail`), which is why `description` and `posted` + are empty here.""" + data = json.loads(body) + listed = data.get("result") if isinstance(data, dict) else None + if not isinstance(listed, list): + raise ValueError("not a BambooHR listing: no result list") + stated = (data.get("meta") or {}).get("totalCount") + if isinstance(stated, int) and stated > len(listed): + raise ValueError(f"BambooHR listing has {len(listed)} of {stated} roles") + out = [] + for j in listed: + title = (j.get("jobOpeningName") or "").strip() + source_id = str(j.get("id") or "") + if not title or not source_id: + continue + out.append({ + "source_id": source_id, + "title": title, + "location": _place(j), + "url": f"https://{host(slug)}/careers/{source_id}", + "posted": None, + "department": str(j.get("departmentLabel") or "").strip(), + "description": "", + "remote": _remote(j), + "salary_text": "", # the list states no pay; the detail's `compensation` was null + }) + return out + + +def detail(get: Get, slug: str, row: Row) -> dict[str, Any]: + """`/careers//detail` -> `{"result": {"jobOpening": {...}}}`, with the + HTML `description`, `datePosted` (a date), `location` (`city`, `state`, + `addressCountry`) and `locationType`. The location is the listing's with + the country added, since the listing has none.""" + data = json.loads(get(f"https://{host(slug)}/careers/{row['source_id']}/detail", + headers=_JSON)) + opening = ((data.get("result") or {}).get("jobOpening") + if isinstance(data, dict) else None) + if not isinstance(opening, dict): + raise ValueError("not a BambooHR role: no result.jobOpening") + out: dict[str, Any] = { + "description": " ".join(html.unescape(strip_html(opening.get("description") or "")).split()), + "posted": parse_dt(opening.get("datePosted")), + } + if place := _place(opening): + out["location"] = place + if remote := _remote(opening): + out["remote"] = remote + return out diff --git a/tests/fixtures/ats/bamboohr-detail-26.json b/tests/fixtures/ats/bamboohr-detail-26.json new file mode 100644 index 0000000..523e39b --- /dev/null +++ b/tests/fixtures/ats/bamboohr-detail-26.json @@ -0,0 +1 @@ +{"meta":{},"result":{"jobOpening":{"jobOpeningShareUrl":"https:\/\/configit.bamboohr.com\/careers\/26","jobOpeningName":"Unsolicited application - All Configit locations","jobOpeningStatus":"Open","jobCategoryId":null,"departmentId":null,"departmentLabel":"","employmentStatusLabel":"Full-Time","employmentType":null,"location":{"city":"K\u00f8benhavn \u00d8","state":null,"postalCode":"2100","addressCountry":"Denmark"},"atsLocation":{"country":null,"countryId":null,"state":null,"city":null},"description":"

Hi,<\/p>\n


<\/p>\n

If there is currently no vacant position that matches your skills, you are welcome to send us an unsolicited application.<\/p>\n


<\/p>\n

We are curious to hear about you and why you'd like to join us.<\/p>\n


<\/p>\n

Please also let us know in which of our locations you'd like to work:<\/p>\n


<\/p>\n

    \n
  • Copenhagen (Denmark)<\/li>\n
  • Langenfeld (Germany, D\u00fcsseldorf\/Cologne area)<\/li>\n
  • UK (remote)<\/li>\n
  • US (Atlanta)<\/li>\n<\/ul>\n


    <\/p>\n

      <\/ul>\n

      Our Global HR Team and our managers are looking forward to reviewing your application.<\/p>","compensation":null,"datePosted":"2025-10-10","minimumExperience":null,"locationType":"2","seekPromoted":false,"aiProcessingDisclosureEnabled":false},"formFields":{"firstName":{"isRequired":true,"value":"","label":"First Name"},"lastName":{"isRequired":true,"value":"","label":"Last Name"},"email":{"isRequired":true,"value":"","label":"Email"},"phone":{"isRequired":true,"value":"","label":"Phone"},"streetAddress":{"isRequired":true,"value":"","label":"Address"},"city":{"isRequired":true,"value":"","label":"City"},"state":{"isRequired":true,"value":"","label":"State","options":[]},"zip":{"isRequired":true,"value":"","label":"ZIP"},"countryId":{"isRequired":true,"value":"57","label":"Country","options":[{"id":"1","text":"United States"},{"id":"2","text":"Canada"},{"id":"3","text":"Australia"},{"id":"4","text":"Afghanistan"},{"id":"5","text":"Albania"},{"id":"6","text":"Algeria"},{"id":"7","text":"American Samoa"},{"id":"8","text":"Andorra"},{"id":"9","text":"Anguilla"},{"id":"10","text":"Angola"},{"id":"11","text":"Antarctica"},{"id":"12","text":"Antigua and Barbuda"},{"id":"13","text":"Argentina"},{"id":"14","text":"Armenia"},{"id":"15","text":"Aruba"},{"id":"16","text":"Austria"},{"id":"17","text":"Azerbaijan"},{"id":"18","text":"Bahamas"},{"id":"19","text":"Bahrain"},{"id":"20","text":"Bangladesh"},{"id":"21","text":"Barbados"},{"id":"22","text":"Belgium"},{"id":"23","text":"Belize"},{"id":"24","text":"Benin"},{"id":"25","text":"Bermuda"},{"id":"26","text":"Bhutan"},{"id":"27","text":"Bolivia"},{"id":"28","text":"Bosnia and Herzegovina"},{"id":"29","text":"Botswana"},{"id":"30","text":"Bouvet Island"},{"id":"31","text":"Brazil"},{"id":"32","text":"British Indian Ocean Territory"},{"id":"33","text":"Brunei Darussalam"},{"id":"34","text":"Bulgaria"},{"id":"35","text":"Burkina Faso"},{"id":"36","text":"Burundi"},{"id":"37","text":"Cambodia"},{"id":"38","text":"Cameroon"},{"id":"39","text":"Cape Verde"},{"id":"40","text":"Cayman Islands"},{"id":"41","text":"Central African Republic"},{"id":"42","text":"Chad"},{"id":"43","text":"Chile"},{"id":"44","text":"China"},{"id":"45","text":"Christmas Island"},{"id":"46","text":"Cocos (Keeling Islands)"},{"id":"47","text":"Colombia"},{"id":"48","text":"Comoros"},{"id":"49","text":"Congo"},{"id":"50","text":"Cook Islands"},{"id":"51","text":"Costa Rica"},{"id":"52","text":"Cote D'Ivoire (Ivory Coast)"},{"id":"53","text":"Croatia (Hrvatska)"},{"id":"54","text":"Cuba"},{"id":"55","text":"Cyprus"},{"id":"56","text":"Czech Republic"},{"id":"57","text":"Denmark"},{"id":"58","text":"Djibouti"},{"id":"59","text":"Dominica"},{"id":"60","text":"Dominican Republic"},{"id":"61","text":"East Timor"},{"id":"62","text":"Egypt"},{"id":"63","text":"El Salvador"},{"id":"64","text":"Ecuador"},{"id":"65","text":"Equatorial Guinea"},{"id":"66","text":"Eritrea"},{"id":"67","text":"Estonia"},{"id":"68","text":"Ethiopia"},{"id":"69","text":"Falkland Islands (Malvinas)"},{"id":"70","text":"Faroe Islands"},{"id":"71","text":"Fiji"},{"id":"72","text":"Finland"},{"id":"73","text":"France"},{"id":"74","text":"France, Metropolitan"},{"id":"75","text":"French Guiana"},{"id":"76","text":"French Polynesia"},{"id":"77","text":"French Southern Territories"},{"id":"78","text":"French West Indies"},{"id":"79","text":"Gabon"},{"id":"80","text":"Gambia"},{"id":"81","text":"Georgia"},{"id":"82","text":"Germany"},{"id":"83","text":"Ghana"},{"id":"84","text":"Gibraltar"},{"id":"85","text":"Greece"},{"id":"86","text":"Greenland"},{"id":"87","text":"Grenada"},{"id":"88","text":"Guadeloupe"},{"id":"89","text":"Guam"},{"id":"90","text":"Guatemala"},{"id":"91","text":"Guinea"},{"id":"92","text":"Guinea-Bissau"},{"id":"93","text":"Guyana"},{"id":"94","text":"Haiti"},{"id":"95","text":"Heard and McDonald Islands"},{"id":"96","text":"Honduras"},{"id":"97","text":"Hong Kong"},{"id":"98","text":"Hungary"},{"id":"99","text":"Iceland"},{"id":"100","text":"India"},{"id":"101","text":"Indonesia"},{"id":"102","text":"Iran"},{"id":"103","text":"Iraq"},{"id":"104","text":"Ireland"},{"id":"105","text":"Israel"},{"id":"106","text":"Italy"},{"id":"107","text":"Jamaica"},{"id":"108","text":"Japan"},{"id":"109","text":"Jordan"},{"id":"110","text":"Kazakhstan"},{"id":"111","text":"Kenya"},{"id":"112","text":"Kiribati"},{"id":"113","text":"Korea (North)"},{"id":"114","text":"Korea (South)"},{"id":"115","text":"Kuwait"},{"id":"116","text":"Kyrgyzstan"},{"id":"117","text":"Laos"},{"id":"118","text":"Latvia"},{"id":"119","text":"Lebanon"},{"id":"120","text":"Lesotho"},{"id":"121","text":"Liberia"},{"id":"122","text":"Libya"},{"id":"123","text":"Liechtenstein"},{"id":"124","text":"Lithuania"},{"id":"125","text":"Luxembourg"},{"id":"126","text":"Macao"},{"id":"127","text":"Macedonia"},{"id":"128","text":"Madagascar"},{"id":"129","text":"Malawi"},{"id":"130","text":"Malaysia"},{"id":"131","text":"Maldives"},{"id":"132","text":"Mali"},{"id":"133","text":"Malta"},{"id":"134","text":"Marshall Islands"},{"id":"135","text":"Martinique"},{"id":"136","text":"Mauritania"},{"id":"137","text":"Mauritius"},{"id":"138","text":"Mayotte"},{"id":"139","text":"Mexico"},{"id":"140","text":"Micronesia"},{"id":"141","text":"Moldova"},{"id":"142","text":"Monaco"},{"id":"143","text":"Mongolia"},{"id":"144","text":"Montenegro"},{"id":"145","text":"Montserrat"},{"id":"146","text":"Morocco"},{"id":"147","text":"Mozambique"},{"id":"148","text":"Namibia"},{"id":"149","text":"Nauru"},{"id":"150","text":"Nepal"},{"id":"151","text":"Netherlands"},{"id":"152","text":"Netherlands Antilles"},{"id":"153","text":"New Caledonia"},{"id":"154","text":"New Zealand"},{"id":"155","text":"Nicaragua"},{"id":"156","text":"Niger"},{"id":"157","text":"Nigeria"},{"id":"158","text":"Niue"},{"id":"159","text":"Norfolk Island"},{"id":"160","text":"Northern Mariana Islands"},{"id":"161","text":"Norway"},{"id":"162","text":"Oman"},{"id":"163","text":"Pakistan"},{"id":"164","text":"Palau"},{"id":"165","text":"Panama"},{"id":"166","text":"Papua New Guinea"},{"id":"167","text":"Paraguay"},{"id":"168","text":"Peru"},{"id":"169","text":"Philippines"},{"id":"170","text":"Pitcairn"},{"id":"171","text":"Poland"},{"id":"172","text":"Portugal"},{"id":"173","text":"Puerto Rico"},{"id":"174","text":"Qatar"},{"id":"175","text":"Rwanda"},{"id":"176","text":"Reunion"},{"id":"177","text":"Romania"},{"id":"178","text":"Russian Federation"},{"id":"179","text":"Samoa"},{"id":"180","text":"San Marino"},{"id":"181","text":"Sao Tome and Principe"},{"id":"182","text":"Saudi Arabia"},{"id":"183","text":"Senegal"},{"id":"184","text":"Serbia"},{"id":"185","text":"Seychelles"},{"id":"186","text":"Sierra Leone"},{"id":"187","text":"Singapore"},{"id":"188","text":"Slovakia"},{"id":"189","text":"Slovenia"},{"id":"190","text":"Solomon Islands"},{"id":"191","text":"South Africa"},{"id":"192","text":"Spain"},{"id":"193","text":"Sri Lanka"},{"id":"194","text":"St. Helena"},{"id":"195","text":"Saint Kitts and Nevis"},{"id":"196","text":"Saint Lucia"},{"id":"197","text":"St. Pierre and Miquelon"},{"id":"198","text":"Saint Vincent and the Grenadines"},{"id":"199","text":"Sudan"},{"id":"200","text":"Suriname"},{"id":"201","text":"Svalbard"},{"id":"202","text":"Swaziland"},{"id":"203","text":"Sweden"},{"id":"204","text":"Switzerland"},{"id":"205","text":"Syria"},{"id":"206","text":"Taiwan"},{"id":"207","text":"Tajikistan"},{"id":"208","text":"Tanzania"},{"id":"209","text":"Thailand"},{"id":"210","text":"Togo"},{"id":"211","text":"Tokelau"},{"id":"212","text":"Tonga"},{"id":"213","text":"Trinidad and Tobago"},{"id":"214","text":"Tunisia"},{"id":"215","text":"Turkey"},{"id":"216","text":"Turkmenistan"},{"id":"217","text":"Turks and Caicos Islands"},{"id":"218","text":"Tuvalu"},{"id":"219","text":"Uganda"},{"id":"220","text":"Ukraine"},{"id":"221","text":"United Arab Emirates"},{"id":"222","text":"United Kingdom"},{"id":"223","text":"US Minor Outlying Islands"},{"id":"224","text":"Uruguay"},{"id":"225","text":"Uzbekistan"},{"id":"226","text":"Vanuatu"},{"id":"227","text":"Vatican City State"},{"id":"228","text":"Venezuela"},{"id":"229","text":"Viet Nam"},{"id":"230","text":"Virgin Islands (British)"},{"id":"231","text":"Virgin Islands, U.S."},{"id":"232","text":"Wallis and Futuna Islands"},{"id":"233","text":"Western Sahara"},{"id":"234","text":"Yemen"},{"id":"235","text":"Yugoslavia"},{"id":"236","text":"Zaire"},{"id":"237","text":"Zambia"},{"id":"238","text":"\u00c5land Islands"},{"id":"239","text":"Saint Barth\u00e9lemy"},{"id":"240","text":"Bonaire, Sint Eustatius and Saba"},{"id":"241","text":"Belarus"},{"id":"242","text":"Congo, the Democratic Republic of the"},{"id":"243","text":"Cura\u00e7ao"},{"id":"244","text":"Guernsey"},{"id":"245","text":"South Georgia and the South Sandwich Islands"},{"id":"246","text":"Isle of Man"},{"id":"247","text":"Jersey"},{"id":"248","text":"Myanmar"},{"id":"249","text":"Palestinian Territories"},{"id":"250","text":"Somalia"},{"id":"251","text":"South Sudan"},{"id":"252","text":"Sint Maarten (Dutch part)"},{"id":"253","text":"Zimbabwe"},{"id":"254","text":"Kosovo"},{"id":"255","text":"Kurdistan"},{"id":"256","text":"Saint Martin (French part)"}]},"linkedinUrl":{"isRequired":false,"value":"","label":"LinkedIn URL"},"resumeFileId":{"isRequired":true,"value":"","label":"Resume"},"coverLetterFileId":{"isRequired":true,"value":"","label":"Cover Letter"},"customQuestions":[{"id":"61","isRequired":true,"question":"By submitting my application, I agree that: \u2022\tConfigit A\/S (Data Controller) may process my personal data for recruitment purposes, as described in the Privacy Policy (go.configit.com\/privacy-policy-bamboohr). \u2022\tMy data will be stored securely in the Applicant Tracking System (ATS) provided by BambooHR (Data Processor). \u2022\tMy data will be retained for 6 months after the recruitment process, unless I consent to longer storage in a talent pool.","type":"checkbox","value":"","isValueOther":false,"hasOther":"no","options":[]}],"genderId":[],"ethnicityId":[],"veteranStatusId":[],"disabilityId":[]}}} \ No newline at end of file diff --git a/tests/fixtures/ats/bamboohr-detail-37.json b/tests/fixtures/ats/bamboohr-detail-37.json new file mode 100644 index 0000000..b0969dc --- /dev/null +++ b/tests/fixtures/ats/bamboohr-detail-37.json @@ -0,0 +1 @@ +{"meta":{},"result":{"jobOpening":{"jobOpeningShareUrl":"https:\/\/configit.bamboohr.com\/careers\/37","jobOpeningName":"Demand Generation Specialist - 12-Month Maternity Cover","jobOpeningStatus":"Open","jobCategoryId":null,"departmentId":"18571","departmentLabel":"Marketing","employmentStatusLabel":"Full-Time","employmentType":null,"location":{"city":"K\u00f8benhavn \u00d8","state":null,"postalCode":"2100","addressCountry":"Denmark"},"atsLocation":{"country":null,"countryId":null,"state":null,"city":null},"description":"

      Our Global Marketing Team is looking for a driven, creative, and passionate individual to join us for a 12-month fixed-term maternity cover. You\u2019ll help drive pipeline growth through impactful inbound and outbound campaigns that build awareness, generate demand, and deliver high-quality leads. If you\u2019re a hands-on marketer who enjoys turning strategy into results, we\u2019d love to hear from you<\/span>!<\/span><\/em><\/p>\n


      <\/p>\n

      Configit is an ambitious and growing SaaS company working in the domain of complex product and sales configuration. We help large international corporations optimize their processes and drive cross-functional innovation through our Configuration Lifecycle Management approach. \u00a0<\/span>
      <\/p>\n


      <\/p>\n

      Within our dedicated Marketing Team, you will focus on refining existing marketing channels and developing new integrated digital campaigns with effective messaging to generate a qualified pipeline, to accelerate deals, and to grow our revenue.<\/span><\/p>\n

      \u00a0<\/span><\/p>\n

      Your Responsibilities<\/span><\/span><\/p>\n

        \n
      • Create new and optimize existing inbound and outbound demand and lead generation programs across email and web.<\/span><\/li>\n
      • Develop, plan, and execute campaigns for paid search, retargeting, paid social channels, and email marketing.<\/span><\/li>\n
      • Execute and optimize ABM and ABS campaigns.<\/span><\/li>\n
      • Experiment with generative AI and other emerging marketing technologies to identify opportunities to improve marketing effectiveness and efficiency.<\/span><\/li>\n
      • Identify most effective marketing messages, value propositions, material, channels, and calls to action for target accounts.<\/span><\/li>\n
      • Measure, analyze, and report on the impact of marketing campaigns.<\/span><\/li>\n
      • Manage projects like the creation of campaign landing pages, creatives, and other digital marketing assets.<\/span><\/li>\n
      • Use intelligence from our intent data sources like 6sense and Dreamdata.<\/span><\/li>\n
      • Closely collaborate with core Sales, Marketing, Product Marketing, and Product Management functions.<\/span><\/li>\n<\/ul>\n

        \u00a0<\/span><\/p>\n

        Your Skills & Experience<\/span><\/span><\/p>\n

          \n
        • Bachelor\u2019s or Master\u2019s degree in Marketing, Business, or a related field.<\/span><\/li>\n
        • 3+ years of experience in digital marketing.<\/span><\/li>\n
        • Proficiency with marketing automation platforms, preferably Pardot.<\/span><\/li>\n
        • Familiarity with digital advertising platforms such as Google Ads, Google Analytics, Bing, LinkedIn Campaign Manager.<\/span><\/li>\n
        • Comfortable using generative AI tools in day-to-day marketing work and curious about identifying new ways to apply AI to improve quality, speed, personalization, and performance.<\/span><\/li>\n
        • Ability to critically evaluate AI-generated output and combine AI capabilities with strong marketing judgment, brand understanding, and human creativity.<\/span><\/li>\n
        • Experience building or improving AI-assisted workflows, prompts, or marketing automations is an advantage.<\/span><\/li>\n
        • Proven project management skills with attention to detail and ability to multitask.<\/span><\/li>\n
        • Strong analytical skills with the ability to interpret data, identify trends, and make data-driven decisions.<\/span><\/li>\n
        • Excellent communicator who enjoys collaborating across functions and geographies.<\/span><\/li>\n
        • Full English proficiency.<\/span><\/li>\n<\/ul>\n

          \u00a0<\/span><\/p>\n

          What you'll find with us<\/span><\/span><\/p>\n

            \n
          • We provide a unique opportunity to work in a dynamic, ambitious, international company.<\/span><\/li>\n
          • We live our values * Business Focus * One Team * Can-do Attitude * Knowledge * Move Fast *.<\/span><\/li>\n
          • You will be based in our Danish office\u00a0but also work with colleagues in the US and Germany.<\/span><\/li>\n
          • Our HQ in Copenhagen has been recently renovated \u2013 we have beautiful views of the water and a great link to public transportation.<\/span><\/li>\n
          • We offer a flexible working policy.<\/span><\/li>\n
          • We work closely together in an international environment and across all professional disciplines.<\/span><\/li>\n
          • We have an informal and open culture with direct communication on all levels.<\/span><\/li>\n
          • We offer lots\u00a0of opportunities to socialize and get to know your colleagues better.<\/span><\/li>\n<\/ul>\n

            \u00a0<\/span><\/p>\n

            At Configit, we are committed to creating a diverse and inclusive workplace where our employees can thrive. We are proud to employ people of all backgrounds, and your unique talents and experiences will be welcomed. Be a part of an exciting team!<\/em><\/p>\n


            <\/p>\n

            #LI-CONFIGIT, #LI-HYBRID<\/span><\/p>","compensation":null,"datePosted":"2026-09-23","minimumExperience":"Mid-level","locationType":"2","seekPromoted":false,"aiProcessingDisclosureEnabled":false},"formFields":{"firstName":{"isRequired":true,"value":"","label":"First Name"},"lastName":{"isRequired":true,"value":"","label":"Last Name"},"email":{"isRequired":true,"value":"","label":"Email"},"phone":{"isRequired":true,"value":"","label":"Phone"},"streetAddress":{"isRequired":true,"value":"","label":"Address"},"city":{"isRequired":true,"value":"","label":"City"},"state":{"isRequired":true,"value":"","label":"State","options":[]},"zip":{"isRequired":true,"value":"","label":"ZIP"},"countryId":{"isRequired":true,"value":"57","label":"Country","options":[{"id":"1","text":"United States"},{"id":"2","text":"Canada"},{"id":"3","text":"Australia"},{"id":"4","text":"Afghanistan"},{"id":"5","text":"Albania"},{"id":"6","text":"Algeria"},{"id":"7","text":"American Samoa"},{"id":"8","text":"Andorra"},{"id":"9","text":"Anguilla"},{"id":"10","text":"Angola"},{"id":"11","text":"Antarctica"},{"id":"12","text":"Antigua and Barbuda"},{"id":"13","text":"Argentina"},{"id":"14","text":"Armenia"},{"id":"15","text":"Aruba"},{"id":"16","text":"Austria"},{"id":"17","text":"Azerbaijan"},{"id":"18","text":"Bahamas"},{"id":"19","text":"Bahrain"},{"id":"20","text":"Bangladesh"},{"id":"21","text":"Barbados"},{"id":"22","text":"Belgium"},{"id":"23","text":"Belize"},{"id":"24","text":"Benin"},{"id":"25","text":"Bermuda"},{"id":"26","text":"Bhutan"},{"id":"27","text":"Bolivia"},{"id":"28","text":"Bosnia and Herzegovina"},{"id":"29","text":"Botswana"},{"id":"30","text":"Bouvet Island"},{"id":"31","text":"Brazil"},{"id":"32","text":"British Indian Ocean Territory"},{"id":"33","text":"Brunei Darussalam"},{"id":"34","text":"Bulgaria"},{"id":"35","text":"Burkina Faso"},{"id":"36","text":"Burundi"},{"id":"37","text":"Cambodia"},{"id":"38","text":"Cameroon"},{"id":"39","text":"Cape Verde"},{"id":"40","text":"Cayman Islands"},{"id":"41","text":"Central African Republic"},{"id":"42","text":"Chad"},{"id":"43","text":"Chile"},{"id":"44","text":"China"},{"id":"45","text":"Christmas Island"},{"id":"46","text":"Cocos (Keeling Islands)"},{"id":"47","text":"Colombia"},{"id":"48","text":"Comoros"},{"id":"49","text":"Congo"},{"id":"50","text":"Cook Islands"},{"id":"51","text":"Costa Rica"},{"id":"52","text":"Cote D'Ivoire (Ivory Coast)"},{"id":"53","text":"Croatia (Hrvatska)"},{"id":"54","text":"Cuba"},{"id":"55","text":"Cyprus"},{"id":"56","text":"Czech Republic"},{"id":"57","text":"Denmark"},{"id":"58","text":"Djibouti"},{"id":"59","text":"Dominica"},{"id":"60","text":"Dominican Republic"},{"id":"61","text":"East Timor"},{"id":"62","text":"Egypt"},{"id":"63","text":"El Salvador"},{"id":"64","text":"Ecuador"},{"id":"65","text":"Equatorial Guinea"},{"id":"66","text":"Eritrea"},{"id":"67","text":"Estonia"},{"id":"68","text":"Ethiopia"},{"id":"69","text":"Falkland Islands (Malvinas)"},{"id":"70","text":"Faroe Islands"},{"id":"71","text":"Fiji"},{"id":"72","text":"Finland"},{"id":"73","text":"France"},{"id":"74","text":"France, Metropolitan"},{"id":"75","text":"French Guiana"},{"id":"76","text":"French Polynesia"},{"id":"77","text":"French Southern Territories"},{"id":"78","text":"French West Indies"},{"id":"79","text":"Gabon"},{"id":"80","text":"Gambia"},{"id":"81","text":"Georgia"},{"id":"82","text":"Germany"},{"id":"83","text":"Ghana"},{"id":"84","text":"Gibraltar"},{"id":"85","text":"Greece"},{"id":"86","text":"Greenland"},{"id":"87","text":"Grenada"},{"id":"88","text":"Guadeloupe"},{"id":"89","text":"Guam"},{"id":"90","text":"Guatemala"},{"id":"91","text":"Guinea"},{"id":"92","text":"Guinea-Bissau"},{"id":"93","text":"Guyana"},{"id":"94","text":"Haiti"},{"id":"95","text":"Heard and McDonald Islands"},{"id":"96","text":"Honduras"},{"id":"97","text":"Hong Kong"},{"id":"98","text":"Hungary"},{"id":"99","text":"Iceland"},{"id":"100","text":"India"},{"id":"101","text":"Indonesia"},{"id":"102","text":"Iran"},{"id":"103","text":"Iraq"},{"id":"104","text":"Ireland"},{"id":"105","text":"Israel"},{"id":"106","text":"Italy"},{"id":"107","text":"Jamaica"},{"id":"108","text":"Japan"},{"id":"109","text":"Jordan"},{"id":"110","text":"Kazakhstan"},{"id":"111","text":"Kenya"},{"id":"112","text":"Kiribati"},{"id":"113","text":"Korea (North)"},{"id":"114","text":"Korea (South)"},{"id":"115","text":"Kuwait"},{"id":"116","text":"Kyrgyzstan"},{"id":"117","text":"Laos"},{"id":"118","text":"Latvia"},{"id":"119","text":"Lebanon"},{"id":"120","text":"Lesotho"},{"id":"121","text":"Liberia"},{"id":"122","text":"Libya"},{"id":"123","text":"Liechtenstein"},{"id":"124","text":"Lithuania"},{"id":"125","text":"Luxembourg"},{"id":"126","text":"Macao"},{"id":"127","text":"Macedonia"},{"id":"128","text":"Madagascar"},{"id":"129","text":"Malawi"},{"id":"130","text":"Malaysia"},{"id":"131","text":"Maldives"},{"id":"132","text":"Mali"},{"id":"133","text":"Malta"},{"id":"134","text":"Marshall Islands"},{"id":"135","text":"Martinique"},{"id":"136","text":"Mauritania"},{"id":"137","text":"Mauritius"},{"id":"138","text":"Mayotte"},{"id":"139","text":"Mexico"},{"id":"140","text":"Micronesia"},{"id":"141","text":"Moldova"},{"id":"142","text":"Monaco"},{"id":"143","text":"Mongolia"},{"id":"144","text":"Montenegro"},{"id":"145","text":"Montserrat"},{"id":"146","text":"Morocco"},{"id":"147","text":"Mozambique"},{"id":"148","text":"Namibia"},{"id":"149","text":"Nauru"},{"id":"150","text":"Nepal"},{"id":"151","text":"Netherlands"},{"id":"152","text":"Netherlands Antilles"},{"id":"153","text":"New Caledonia"},{"id":"154","text":"New Zealand"},{"id":"155","text":"Nicaragua"},{"id":"156","text":"Niger"},{"id":"157","text":"Nigeria"},{"id":"158","text":"Niue"},{"id":"159","text":"Norfolk Island"},{"id":"160","text":"Northern Mariana Islands"},{"id":"161","text":"Norway"},{"id":"162","text":"Oman"},{"id":"163","text":"Pakistan"},{"id":"164","text":"Palau"},{"id":"165","text":"Panama"},{"id":"166","text":"Papua New Guinea"},{"id":"167","text":"Paraguay"},{"id":"168","text":"Peru"},{"id":"169","text":"Philippines"},{"id":"170","text":"Pitcairn"},{"id":"171","text":"Poland"},{"id":"172","text":"Portugal"},{"id":"173","text":"Puerto Rico"},{"id":"174","text":"Qatar"},{"id":"175","text":"Rwanda"},{"id":"176","text":"Reunion"},{"id":"177","text":"Romania"},{"id":"178","text":"Russian Federation"},{"id":"179","text":"Samoa"},{"id":"180","text":"San Marino"},{"id":"181","text":"Sao Tome and Principe"},{"id":"182","text":"Saudi Arabia"},{"id":"183","text":"Senegal"},{"id":"184","text":"Serbia"},{"id":"185","text":"Seychelles"},{"id":"186","text":"Sierra Leone"},{"id":"187","text":"Singapore"},{"id":"188","text":"Slovakia"},{"id":"189","text":"Slovenia"},{"id":"190","text":"Solomon Islands"},{"id":"191","text":"South Africa"},{"id":"192","text":"Spain"},{"id":"193","text":"Sri Lanka"},{"id":"194","text":"St. Helena"},{"id":"195","text":"Saint Kitts and Nevis"},{"id":"196","text":"Saint Lucia"},{"id":"197","text":"St. Pierre and Miquelon"},{"id":"198","text":"Saint Vincent and the Grenadines"},{"id":"199","text":"Sudan"},{"id":"200","text":"Suriname"},{"id":"201","text":"Svalbard"},{"id":"202","text":"Swaziland"},{"id":"203","text":"Sweden"},{"id":"204","text":"Switzerland"},{"id":"205","text":"Syria"},{"id":"206","text":"Taiwan"},{"id":"207","text":"Tajikistan"},{"id":"208","text":"Tanzania"},{"id":"209","text":"Thailand"},{"id":"210","text":"Togo"},{"id":"211","text":"Tokelau"},{"id":"212","text":"Tonga"},{"id":"213","text":"Trinidad and Tobago"},{"id":"214","text":"Tunisia"},{"id":"215","text":"Turkey"},{"id":"216","text":"Turkmenistan"},{"id":"217","text":"Turks and Caicos Islands"},{"id":"218","text":"Tuvalu"},{"id":"219","text":"Uganda"},{"id":"220","text":"Ukraine"},{"id":"221","text":"United Arab Emirates"},{"id":"222","text":"United Kingdom"},{"id":"223","text":"US Minor Outlying Islands"},{"id":"224","text":"Uruguay"},{"id":"225","text":"Uzbekistan"},{"id":"226","text":"Vanuatu"},{"id":"227","text":"Vatican City State"},{"id":"228","text":"Venezuela"},{"id":"229","text":"Viet Nam"},{"id":"230","text":"Virgin Islands (British)"},{"id":"231","text":"Virgin Islands, U.S."},{"id":"232","text":"Wallis and Futuna Islands"},{"id":"233","text":"Western Sahara"},{"id":"234","text":"Yemen"},{"id":"235","text":"Yugoslavia"},{"id":"236","text":"Zaire"},{"id":"237","text":"Zambia"},{"id":"238","text":"\u00c5land Islands"},{"id":"239","text":"Saint Barth\u00e9lemy"},{"id":"240","text":"Bonaire, Sint Eustatius and Saba"},{"id":"241","text":"Belarus"},{"id":"242","text":"Congo, the Democratic Republic of the"},{"id":"243","text":"Cura\u00e7ao"},{"id":"244","text":"Guernsey"},{"id":"245","text":"South Georgia and the South Sandwich Islands"},{"id":"246","text":"Isle of Man"},{"id":"247","text":"Jersey"},{"id":"248","text":"Myanmar"},{"id":"249","text":"Palestinian Territories"},{"id":"250","text":"Somalia"},{"id":"251","text":"South Sudan"},{"id":"252","text":"Sint Maarten (Dutch part)"},{"id":"253","text":"Zimbabwe"},{"id":"254","text":"Kosovo"},{"id":"255","text":"Kurdistan"},{"id":"256","text":"Saint Martin (French part)"}]},"linkedinUrl":{"isRequired":false,"value":"","label":"LinkedIn URL"},"coverLetterFileId":{"isRequired":true,"value":"","label":"Cover Letter"},"resumeFileId":{"isRequired":true,"value":"","label":"Resume"},"customQuestions":[{"id":"70","isRequired":false,"question":"By submitting my application, I agree that: \u2022 Configit A\/S (Data Controller) may process my personal data for recruitment purposes, as described in the Privacy Policy (go.configit.com\/privacy-policy-bamboohr). \u2022 My data will be stored securely in the Applicant Tracking System (ATS) provided by BambooHR (Data Processor). \u2022 My data will be retained for 6 months after the recruitment process has been closed, unless I consent to longer storage in a talent pool.","type":"checkbox","value":"","isValueOther":false,"hasOther":"no","options":[]}],"genderId":[],"ethnicityId":[],"veteranStatusId":[],"disabilityId":[]}}} \ No newline at end of file diff --git a/tests/fixtures/ats/bamboohr.json b/tests/fixtures/ats/bamboohr.json new file mode 100644 index 0000000..071f476 --- /dev/null +++ b/tests/fixtures/ats/bamboohr.json @@ -0,0 +1 @@ +{"meta":{"totalCount":2},"result":[{"id":"26","jobOpeningName":"Unsolicited application - All Configit locations","departmentId":null,"departmentLabel":null,"employmentStatusLabel":"Full-Time","employmentType":null,"location":{"city":"K\u00f8benhavn \u00d8","state":null},"atsLocation":{"country":null,"state":null,"province":null,"city":null},"isRemote":null,"locationType":"2"},{"id":"37","jobOpeningName":"Demand Generation Specialist - 12-Month Maternity Cover","departmentId":"18571","departmentLabel":"Marketing","employmentStatusLabel":"Full-Time","employmentType":null,"location":{"city":"K\u00f8benhavn \u00d8","state":null},"atsLocation":{"country":null,"state":null,"province":null,"city":null},"isRemote":null,"locationType":"2"}]} \ No newline at end of file diff --git a/tests/test_ats_bamboohr.py b/tests/test_ats_bamboohr.py new file mode 100644 index 0000000..c5f1170 --- /dev/null +++ b/tests/test_ats_bamboohr.py @@ -0,0 +1,185 @@ +"""The BambooHR host module against Configit's saved listing and two saved +role pages. No network.""" + +from __future__ import annotations + +import json +import sys +from datetime import UTC, datetime +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 import discover # noqa: E402 +from plugins import ats, atshosts # noqa: E402 +from plugins.atshosts import bamboohr # noqa: E402 + +FIXTURES = ROOT / "tests" / "fixtures" / "ats" + + +def _read(name: str) -> bytes: + return (FIXTURES / name).read_bytes() + + +def _get_of(answers: dict[str, bytes | Exception], asked: list[tuple[str, Any]]) -> Any: + def get(url: str, *, method: str = "GET", payload: Any = None, + headers: dict[str, str] | None = None) -> bytes: + asked.append((url, headers)) + answer = answers[url] + if isinstance(answer, Exception): + raise answer + return answer + return get + + +def test_a_listing_becomes_rows() -> None: + rows = bamboohr.parse(_read("bamboohr.json"), "configit") + assert [r["source_id"] for r in rows] == ["26", "37"] + # The standing invitation to apply without a role is a role like any other. + assert rows[0]["title"] == "Unsolicited application - All Configit locations" + second = rows[1] + assert second["title"] == "Demand Generation Specialist - 12-Month Maternity Cover" + assert second["url"] == "https://configit.bamboohr.com/careers/37" + assert second["department"] == "Marketing" and rows[0]["department"] == "" + assert second["location"] == "København Ø" + assert second["remote"] == "hybrid" + assert (second["posted"], second["description"], second["salary_text"]) == (None, "", "") + + +@pytest.mark.parametrize(("flag", "kind", "remote"), [ + (True, "0", "remote"), (None, "0", "onsite"), (None, "1", "remote"), (None, "2", "hybrid"), + (None, None, None), (False, "7", None)]) +def test_remote_is_the_flag_then_the_location_type( + flag: bool | None, kind: str | None, remote: str | None) -> None: + body = json.loads(_read("bamboohr.json")) + body["result"][0] |= {"isRemote": flag, "locationType": kind} + assert bamboohr.parse(json.dumps(body).encode(), "configit")[0]["remote"] == remote + + +def test_the_location_reads_the_state_and_the_ats_location_too() -> None: + body = json.loads(_read("bamboohr.json")) + body["result"][0]["location"] = {"city": "Austin", "state": "Texas"} + body["result"][1]["location"] = {"city": None, "state": None} + body["result"][1]["atsLocation"] = {"city": "Lyon", "state": None, "country": "France"} + rows = bamboohr.parse(json.dumps(body).encode(), "configit") + assert [r["location"] for r in rows] == ["Austin, Texas", "Lyon, France"] + + +def test_a_list_shorter_than_its_count_is_refused_not_read_as_the_board() -> None: + body = json.loads(_read("bamboohr.json")) + body["meta"]["totalCount"] = 3 + with pytest.raises(ValueError, match="2 of 3"): + bamboohr.parse(json.dumps(body).encode(), "configit") + + +def test_a_page_that_is_not_a_listing_raises_and_an_empty_board_is_no_rows() -> None: + assert bamboohr.parse(b'{"meta": {"totalCount": 0}, "result": []}', "configit") == [] + for body in (b"", b"[]", b'{"result": null}'): + with pytest.raises(ValueError): + bamboohr.parse(body, "configit") + + +def test_a_role_without_a_title_or_an_id_is_left_out() -> None: + body = json.loads(_read("bamboohr.json")) + body["result"][0]["jobOpeningName"] = " " + body["result"][1]["id"] = None + assert bamboohr.parse(json.dumps(body).encode(), "configit") == [] + + +def test_detail_reads_the_text_the_date_and_the_country() -> None: + row = bamboohr.parse(_read("bamboohr.json"), "configit")[1] + asked: list[tuple[str, Any]] = [] + url = "https://configit.bamboohr.com/careers/37/detail" + found = bamboohr.detail(_get_of({url: _read("bamboohr-detail-37.json")}, asked), + "configit", row) + assert asked == [(url, {"Accept": "application/json"})] + assert set(found) <= set(ats.DETAIL_FIELDS) + assert found["posted"] == datetime(2026, 9, 23, tzinfo=UTC) + assert found["location"] == "København Ø, Denmark" + assert found["remote"] == "hybrid" + text = found["description"] + assert text.startswith("Our Global Marketing Team is looking for") + assert "Skills & Experience" in text and "&" not in text and "<" not in text + + +def test_detail_of_the_standing_invitation() -> None: + row = bamboohr.parse(_read("bamboohr.json"), "configit")[0] + url = "https://configit.bamboohr.com/careers/26/detail" + found = bamboohr.detail(_get_of({url: _read("bamboohr-detail-26.json")}, []), "configit", row) + assert found["posted"] == datetime(2025, 10, 10, tzinfo=UTC) + assert found["description"].startswith("Hi, If there is currently no vacant position") + assert "UK (remote)" in found["description"] + + +def test_detail_refuses_an_answer_that_is_not_a_role() -> None: + url = "https://configit.bamboohr.com/careers/37/detail" + row = {"source_id": "37"} + for body in (b"", b'{"result": {}}', b"[]"): + with pytest.raises(ValueError): + bamboohr.detail(_get_of({url: body}, []), "configit", row) + + +def test_the_board_and_its_details_are_read_through_the_app( + monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.setattr(ats, "PAGE_DELAY", 0) + base = "https://configit.bamboohr.com/careers" + seen: list[str] = [] + + def handler(request: httpx.Request) -> httpx.Response: + seen.append(str(request.url)) + if request.url.path == "/careers/list": + return httpx.Response(200, content=_read("bamboohr.json")) + if request.url.path == "/careers/26/detail": + return httpx.Response(404) + assert request.headers["accept"] == "application/json" + return httpx.Response(200, content=_read("bamboohr-detail-37.json")) + + with httpx.Client(transport=httpx.MockTransport(handler)) as client: + rows, complete = ats._fetch_rows(client, "bamboohr:configit") + assert complete and len(rows) == 2 and seen == [f"{base}/list"] + filled, done, failed = ats._read_details(client, "bamboohr:configit", rows, complete, + set(), set()) + assert seen[1:] == [f"{base}/26/detail", f"{base}/37/detail"] + # A 404 counts as read; the other role is filled from its own page. + assert done == {"bamboohr:configit:26", "bamboohr:configit:37"} and failed == set() + assert filled[0]["description"] == "" and filled[1]["location"] == "København Ø, Denmark" + assert filled[1]["posted"] == datetime(2026, 9, 23, tzinfo=UTC) + + +def test_the_slug_the_urls_and_the_allow_list() -> None: + assert bamboohr.slug_ok("configit") and bamboohr.slug_ok("Configit") + assert bamboohr.careers_url("configit") == "https://configit.bamboohr.com/careers" + assert bamboohr.robots_page("configit") == "https://configit.bamboohr.com/careers" + assert bamboohr.feed_url("Configit") == "https://configit.bamboohr.com/careers/list" + allow = bamboohr.allowed("Configit") + assert allow("configit.bamboohr.com") and allow("CONFIGIT.bamboohr.com") + assert not allow("bamboohr.com") and not allow("other.bamboohr.com") + assert not allow("configit.bamboohr.com.evil.example") and not allow("localhost") + assert atshosts.HOSTS["bamboohr"] is bamboohr and ats.HOSTS["bamboohr"] == "BambooHR" + + +@pytest.mark.parametrize("slug", [ + "", "a@b", "a#b", "a?b", "..", "a/b", "a%2fb", "a:443", "a b", " a", "a\n", "a\r\n", + "a.b", "127.0.0.1", "[::1]", "a_b", "2130706433.evil"]) +def test_a_hostile_slug_is_refused(slug: str) -> None: + assert not bamboohr.slug_ok(slug) + assert not ats.is_known_target(f"bamboohr:{slug}") + + +def test_a_local_word_as_a_slug_only_reaches_bamboohrs_own_host() -> None: + allow = bamboohr.allowed("localhost") + assert allow("localhost.bamboohr.com") and not allow("localhost") + + +def test_discovery_finds_the_subdomain_and_not_bamboohrs_own_hosts() -> None: + page = ('' + 'xy' + 'z') + assert [(h, s) for h, s, _ in discover.boards_in(page)] == [("bamboohr", "configit")] + assert "bamboohr" not in {h for h, _ in discover._UNREADABLE if h not in atshosts.HOSTS}