Match a slug whole, and compare an allowed host name without case

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-29 19:42:10 +02:00
1 parent 0ffd0726e9
commit f61caddced
3 files changed
+26 -8

No files matched your search

+15
View File
@@ -117,6 +117,21 @@ def test_the_contract_check_names_each_problem() -> None:
assert "RANK is not an int" in found and "KEEP_CASE is not a bool" in found
@pytest.mark.parametrize("host", ["greenhouse", "lever", "ashby", "workable", "smartrecruiters",
"recruitee", "personio", "teamtailor"])
def test_a_slug_is_matched_whole(host: str) -> None:
assert ats.is_known_target(f"{host}:acme")
for slug in ("acme\n", "acme\r\n", " acme", "acme ", "ac me", "acme/x", "acme?x", "acme#x"):
assert not ats.is_known_target(f"{host}:{slug}"), slug
def test_a_slug_in_the_host_name_is_allowed_whatever_its_case() -> None:
for host, api in (("recruitee", "acme.recruitee.com"), ("personio", "acme.jobs.personio.de")):
allow = ats._allowed_host(host, "Acme")
assert allow(api) and allow(api.upper())
assert not allow(api.replace("acme", "other"))
# ------------------------------------------------------------ the fetch
def _client(handler: Callable[[httpx.Request], httpx.Response]) -> httpx.Client: