Read HR Manager's public position feed by skip and take

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Sonnet 5.5 committed 2026-09-29 20:13:23 +02:00
1 parent 27a7723a1d
commit d80754e985
4 files changed
+402

No files matched your search

+1
View File
@@ -0,0 +1 @@
<rss version="2.0" xmlns:a10="http://www.w3.org/2005/Atom"><channel><title>HR Manager Talent Recruiter - Position List</title><link>https://candidate.hr-manager.net/vacancies/list.aspx?customer=nnit</link><description>HR Manager Talent Recruiter - Position List</description><lastBuildDate>Tue, 29 Sep 2026 20:10:59 +0200</lastBuildDate></channel></rss>
+91
View File
@@ -0,0 +1,91 @@
<rss version="2.0" xmlns:a10="http://www.w3.org/2005/Atom"><channel><title>HR Manager Talent Recruiter - Position List</title><link>https://candidate.hr-manager.net/vacancies/list.aspx?customer=stsgroup_tr</link><description>HR Manager Talent Recruiter - Position List</description><lastBuildDate>Tue, 29 Sep 2026 20:11:15 +0200</lastBuildDate><item><guid isPermaLink="false">143857</guid><link>https://candidate.hr-manager.net/ApplicationInit.aspx?cid=2523&amp;ProjectId=143857&amp;DepartmentId=18958&amp;MediaId=5</link><a10:author/><title>Commissioning Engineer- T&amp;D</title><description>&lt;p&gt;&lt;strong&gt;About the Position&lt;/strong&gt;&lt;/p&gt;&#xD;
&#xD;
&lt;p style="text-align:justify"&gt;We have an exciting opportunity for a Commissioning Engineer, to join STS Group T&amp;D Division.&lt;/p&gt;&#xD;
&#xD;
&lt;p style="text-align:justify"&gt;The position will be located in Ireland.&lt;/p&gt;&#xD;
&#xD;
&lt;p style="text-align:justify"&gt;&lt;br /&gt;&#xD;
STS Group, is dedicated to being the leading and most cost-efficient provider of electrical engineering, instrumentation, design and commissioning services across Ireland, UK, Europe and the Middle East. Since its formation, STS Group has broadened its scope to become a full-service provider to world renowned brand names in the Pharmaceutical, Data Centre, Utilities, Oil, Gas &amp; Chemicals, Food &amp; Beverage, Transport and other industry sectors.&lt;/p&gt;&#xD;
&#xD;
&lt;p style="text-align:justify"&gt;Headquartered in Waterford, Ireland, STS Group is one of three business units within Dussmann Technical Solutions (DTS) and is a proud member of the Dussmann Group. STS Group employs the best people, invests heavily in training and education ensuring that the highest standards of health, safety and governance are applied throughout the organisation&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;&lt;br /&gt;&#xD;
&lt;strong&gt;What you will be doing?&lt;/strong&gt;&lt;/p&gt;&#xD;
&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;</description><pubDate>Tue, 18 Mar 2025 17:31:36 +0100</pubDate><a10:link rel="alternate" type="text/html" title="Commissioning Engineer- T&amp;D" length="9223372036854775807" href="https://candidate.hr-manager.net/ApplicationInit.aspx?cid=2523&amp;ProjectId=143857&amp;DepartmentId=18958&amp;MediaId=5"/><a10:updated>2025-04-02T12:30:03+02:00</a10:updated><a10:content type="html"/></item><item><guid isPermaLink="false">143844</guid><link>https://candidate.hr-manager.net/ApplicationInit.aspx?cid=2523&amp;ProjectId=143844&amp;DepartmentId=18958&amp;MediaId=5</link><a10:author/><title>Electrical Tester- Dublin</title><description>&lt;p&gt;The Company&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;STS Group, is dedicated to being the leading and most cost-efficient provider of electrical engineering, instrumentation, design and commissioning services across Ireland, UK, Europe and the Middle East. Since its formation, STS Group has broadened its scope to become a full-service provider to world renowned brand names in the Pharmaceutical, Data Centre, Utilities, Oil, Gas &amp; Chemicals, Food &amp; Beverage, Transport and other industry sectors.&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;Headquartered in Waterford, Ireland, STS Group is one of three business units within Dussmann Technical Solutions (DTS) and is a proud member of the Dussmann Group. STS Group employs the best people, invests heavily in training and education ensuring that the highest standards of health, safety and governance are applied throughout the organisation.&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt; &lt;/p&gt;&#xD;
&#xD;
&lt;p&gt; &lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;*This company is an equal opportunities employer*&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt; &lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;Job description&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt; &lt;/p&gt;&#xD;
&#xD;
&lt;p&gt; &lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;Duties &amp; Responsibilities:&lt;/p&gt;&#xD;
&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;Fully qualified Electrician with current &lt;strong&gt;Safe Electric (RECI) Certification&lt;/strong&gt;.&lt;/li&gt;</description><pubDate>Tue, 18 Feb 2025 11:02:55 +0100</pubDate><a10:link rel="alternate" type="text/html" title="Electrical Tester- Dublin" length="9223372036854775807" href="https://candidate.hr-manager.net/ApplicationInit.aspx?cid=2523&amp;ProjectId=143844&amp;DepartmentId=18958&amp;MediaId=5"/><a10:updated>2025-02-18T11:05:30+01:00</a10:updated><a10:content type="html"/></item><item><guid isPermaLink="false">143854</guid><link>https://candidate.hr-manager.net/ApplicationInit.aspx?cid=2523&amp;ProjectId=143854&amp;DepartmentId=18958&amp;MediaId=5</link><a10:author/><title>Pre Apprentice- Dublin 15</title><description>&lt;p&gt;Are you a pre Apprentice? Join Our Apprenticeship Program – Your Future Starts Here!&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;Are you ready to jumpstart your career in Electrical &amp; Instrumentation? We're on the lookout for passionate pre-apprentices to join our team. Here’s why this opportunity is a game-changer:&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;What’s in It for You?&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;· Get Rewarded: Signing bonus plus a €1,000 Exceptional Performance Award for every successful apprenticeship year.&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;· Real-World Training: Learn by doing, with hands-on experience from day one.&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;· Globally Recognised Certification: Open doors anywhere in the world with industry-approved qualifications.&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;· Secure Your Future: Enjoy job stability and countless opportunities for growth.&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;· Climb the Ladder: Our "Beyond Apprentice" program fast-tracks your career progression.&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;· Work Variety: Gain experience in diverse environments and departments.&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;· Stay Ahead: Master cutting-edge technologies and stay at the forefront of innovation.&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;What You’ll Be Doing&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;</description><pubDate>Tue, 11 Mar 2025 16:30:53 +0100</pubDate><a10:link rel="alternate" type="text/html" title="Pre Apprentice- Dublin 15" length="9223372036854775807" href="https://candidate.hr-manager.net/ApplicationInit.aspx?cid=2523&amp;ProjectId=143854&amp;DepartmentId=18958&amp;MediaId=5"/><a10:updated>2025-03-11T16:32:11+01:00</a10:updated><a10:content type="html"/></item><item><guid isPermaLink="false">143849</guid><link>https://candidate.hr-manager.net/ApplicationInit.aspx?cid=2523&amp;ProjectId=143849&amp;DepartmentId=18958&amp;MediaId=5</link><a10:author/><title>QS- Cork</title><description>&lt;p&gt;&lt;strong&gt;The Company&lt;/strong&gt;&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;STS Group, is dedicated to being the leading and most cost-efficient provider of electrical engineering, instrumentation, design and commissioning services across Ireland, UK, Europe and the Middle East. Since its formation, STS Group has broadened its scope to become a full-service provider to world renowned brand names in the Pharmaceutical, Data Centre, Utilities, Oil, Gas &amp; Chemicals, Food &amp; Beverage, Transport and other industry sectors.&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;Headquartered in Waterford, Ireland, STS Group is one of three business units within Dussmann Technical Solutions (DTS) and is a proud member of the Dussmann Group. STS Group employs the best people, invests heavily in training and education ensuring that the highest standards of health, safety and governance are applied throughout the organisation&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;*This company is an equal opportunities employer*&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt; &lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;&lt;strong&gt;Quantity Surveyor Criteria:&lt;/strong&gt;&lt;/p&gt;&#xD;
&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;2+ years Post-Graduate experience with a Main Contractor/ Developer.&lt;/li&gt;&#xD;
&lt;li&gt;Qualification in Quantity Surveying or similar area&lt;/li&gt;&#xD;
&lt;li&gt;</description><pubDate>Thu, 06 Mar 2025 15:30:00 +0100</pubDate><a10:link rel="alternate" type="text/html" title="QS- Cork" length="9223372036854775807" href="https://candidate.hr-manager.net/ApplicationInit.aspx?cid=2523&amp;ProjectId=143849&amp;DepartmentId=18958&amp;MediaId=5"/><a10:updated>2025-03-06T15:33:46+01:00</a10:updated><a10:content type="html"/></item><item><guid isPermaLink="false">143848</guid><link>https://candidate.hr-manager.net/ApplicationInit.aspx?cid=2523&amp;ProjectId=143848&amp;DepartmentId=18958&amp;MediaId=5</link><a10:author/><title>QS- Dublin</title><description>&lt;p&gt;&lt;strong&gt;The Company&lt;/strong&gt;&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;STS Group, is dedicated to being the leading and most cost-efficient provider of electrical engineering, instrumentation, design and commissioning services across Ireland, UK, Europe and the Middle East. Since its formation, STS Group has broadened its scope to become a full-service provider to world renowned brand names in the Pharmaceutical, Data Centre, Utilities, Oil, Gas &amp; Chemicals, Food &amp; Beverage, Transport and other industry sectors.&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;Headquartered in Waterford, Ireland, STS Group is one of three business units within Dussmann Technical Solutions (DTS) and is a proud member of the Dussmann Group. STS Group employs the best people, invests heavily in training and education ensuring that the highest standards of health, safety and governance are applied throughout the organisation&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;*This company is an equal opportunities employer*&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt; &lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;&lt;strong&gt;Senior Quantity Surveyor Criteria:&lt;/strong&gt;&lt;/p&gt;&#xD;
&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;2 + years Post-Graduate experience with a Main Contractor/ Developer.&lt;/li&gt;&#xD;
&lt;li&gt;Qualification in Quantity Surveying or similar area&lt;/li&gt;&#xD;
&lt;li&gt;</description><pubDate>Thu, 06 Mar 2025 15:11:42 +0100</pubDate><a10:link rel="alternate" type="text/html" title="QS- Dublin" length="9223372036854775807" href="https://candidate.hr-manager.net/ApplicationInit.aspx?cid=2523&amp;ProjectId=143848&amp;DepartmentId=18958&amp;MediaId=5"/><a10:updated>2025-03-06T15:29:29+01:00</a10:updated><a10:content type="html"/></item></channel></rss>
+196
View File
@@ -0,0 +1,196 @@
"""The HR Manager host module against saved feeds (STS Group's, trimmed to
five roles, and NNIT's, which had none), 2026-09-29. No network."""
from __future__ import annotations
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 hrmanager # noqa: E402
FIXTURES = ROOT / "tests" / "fixtures" / "ats"
BOARD = (FIXTURES / "hrmanager.xml").read_bytes()
EMPTY = (FIXTURES / "hrmanager-empty.xml").read_bytes()
FEED = "https://api.hr-manager.net/JobPortal.svc/stsgroup_tr/PositionList/rss/?incads=true"
def _feed(skip: int, slug: str = "stsgroup_tr") -> str:
return (f"https://api.hr-manager.net/JobPortal.svc/{slug}/PositionList/rss/"
f"?incads=true&skip={skip}&take=100")
def test_rows_read_the_advertisement_and_the_publication_date() -> None:
rows = hrmanager.parse(BOARD, "stsgroup_tr")
assert [r["source_id"] for r in rows] == ["143857", "143844", "143854", "143849", "143848"]
first = rows[0]
assert first["title"] == "Commissioning Engineer- T&D" # `&amp;` in the XML
assert first["url"] == ("https://candidate.hr-manager.net/ApplicationInit.aspx"
"?cid=2523&ProjectId=143857&DepartmentId=18958&MediaId=5")
assert first["description"].startswith("About the Position We have an exciting opportunity")
assert "<" not in first["description"] and "&amp;" not in first["description"]
assert "T&D Division" in first["description"]
assert first["posted"] is not None and first["posted"].isoformat() == \
"2025-03-18T17:31:36+01:00"
# The feed names no place, department, pay or way of working.
assert (first["location"], first["department"], first["salary_text"], first["remote"]) == \
("", "", "", None)
def test_a_channel_with_no_items_is_an_empty_board_and_another_answer_is_not_a_feed() -> None:
assert hrmanager.parse(EMPTY, "nnit") == []
with pytest.raises(ValueError, match="not an HR Manager feed"):
hrmanager.parse(b"<html><body>404 - File or directory not found.</body></html>", "x")
def test_an_item_without_a_title_or_a_web_link_is_skipped() -> None:
body = (b"<rss><channel><item><guid>1</guid><title> </title><link>https://a.example/1</link></item>"
b"<item><guid>2</guid><title>B</title><link>javascript:alert(1)</link></item>"
b"<item><guid>3</guid><title>C</title><link>https://a.example/3</link></item>"
b"</channel></rss>")
assert [r["source_id"] for r in hrmanager.parse(body, "x")] == ["3"]
# ------------------------------------------------------------- paging
def _paged(answers: dict[str, bytes], asked: list[str]) -> Any:
def get(url: str, *, method: str = "GET", payload: Any = None,
headers: dict[str, str] | None = None) -> bytes:
asked.append(url)
return answers[url]
return get
def test_the_page_moves_on_by_what_it_returned_and_ends_on_an_empty_one() -> None:
asked: list[str] = []
get = _paged({_feed(0): BOARD, _feed(5): EMPTY}, asked)
data, results, total, cursor = hrmanager.page(get, "stsgroup_tr", None)
assert len(results) == 5 and total is None and cursor == 5
assert len(hrmanager.rows(data, "stsgroup_tr")) == 5
_, results, total, cursor = hrmanager.page(get, "stsgroup_tr", cursor)
assert results == [] and total is None and cursor is None
assert asked == [_feed(0), _feed(5)]
@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)
monkeypatch.setattr(ats, "PAGE_DELAY", 0)
return {"answers": answers, "asked": asked}
def test_a_board_is_complete_when_the_read_ends_on_an_empty_page(web: dict[str, Any]) -> None:
web["answers"] |= {_feed(0): BOARD, _feed(5): EMPTY}
with httpx.Client() as client:
rows, complete = ats._fetch_rows(client, "hrmanager:stsgroup_tr")
assert len(rows) == 5 and complete
assert web["asked"] == [_feed(0), _feed(5)]
def test_a_board_with_no_roles_is_complete_and_empty(web: dict[str, Any]) -> None:
web["answers"][_feed(0, "seaborg_tr")] = EMPTY
with httpx.Client() as client:
assert ats._fetch_rows(client, "hrmanager:seaborg_tr") == ([], True)
assert web["asked"] == [_feed(0, "seaborg_tr")]
def test_a_page_the_host_repeats_leaves_the_board_incomplete(web: dict[str, Any]) -> None:
"""A host that ignored `skip` would answer the same roles again."""
web["answers"] |= {_feed(0): BOARD, _feed(5): BOARD}
with httpx.Client() as client:
rows, complete = ats._fetch_rows(client, "hrmanager:stsgroup_tr")
assert len(rows) == 5 and not complete
def test_a_429_after_the_first_page_ends_the_read_incomplete(web: dict[str, Any]) -> None:
request = httpx.Request("GET", _feed(5))
web["answers"] |= {_feed(0): BOARD, _feed(5): httpx.HTTPStatusError(
"429", request=request, response=httpx.Response(429, request=request))}
with httpx.Client() as client:
rows, complete = ats._fetch_rows(client, "hrmanager:stsgroup_tr")
assert len(rows) == 5 and not complete
def test_robots_are_read_from_the_api_host_whose_404_allows(web: dict[str, Any]) -> None:
request = httpx.Request("GET", "https://api.hr-manager.net/robots.txt")
web["answers"]["https://api.hr-manager.net/robots.txt"] = httpx.HTTPStatusError(
"404", request=request, response=httpx.Response(404, request=request))
state: dict[str, str] = {}
with httpx.Client() as client:
ats._check_robots(client, "hrmanager:stsgroup_tr", state)
assert '"allowed": true' in state["ats:robots:hrmanager:stsgroup_tr"]
assert web["asked"] == ["https://api.hr-manager.net/robots.txt"]
def test_the_robots_page_is_the_feed_so_that_its_own_hosts_rules_decide(
web: dict[str, Any]) -> None:
web["answers"]["https://api.hr-manager.net/robots.txt"] = \
b"User-agent: *\nDisallow: /JobPortal.svc/\n"
with httpx.Client() as client, pytest.raises(ats._Disallowed):
ats._check_robots(client, "hrmanager:stsgroup_tr")
# ------------------------------------------------------- slugs and hosts
def test_the_module_is_registered_as_a_paged_host() -> None:
assert atshosts.HOSTS["hrmanager"] is hrmanager and ats.HOSTS["hrmanager"] == "HR Manager"
assert hrmanager.NAME == "hrmanager" and not getattr(hrmanager, "KEEP_CASE", False)
assert hasattr(hrmanager, "page") and not hasattr(hrmanager, "detail")
def test_the_urls_and_the_allowed_host() -> None:
assert hrmanager.careers_url("seaborg_tr") == \
"https://candidate.hr-manager.net/vacancies/list.aspx?customer=seaborg_tr"
assert hrmanager.robots_page("stsgroup_tr") == _feed(0)
allow = hrmanager.allowed("stsgroup_tr")
assert allow("api.hr-manager.net") and allow("API.HR-MANAGER.NET")
for host in ("candidate.hr-manager.net", "hr-manager.net", "api.hr-manager.net.evil.example",
"localhost"):
assert not allow(host)
@pytest.mark.parametrize("slug", ["seaborg_tr", "kpmg", "FlyingTiger", "a-b", "9x"])
def test_a_customer_is_one_path_segment(slug: str) -> None:
assert ats.is_known_target(f"hrmanager:{slug}")
@pytest.mark.parametrize("slug", [
"", "a@b", "a#b", "a?b", "a&skip=1", "..", ".", "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 hrmanager.slug_ok(slug)
assert not ats.is_known_target(f"hrmanager:{slug}")
def test_discovery_finds_the_customer() -> None:
page = ('<a href="https://candidate.hr-manager.net/vacancies/list.aspx?customer=seaborg_tr">Jobs</a>'
'<a href="https://candidate.hr-manager.net/Vacancies/List.aspx?customer=KPMG">KPMG</a>'
'<a href="https://candidate.hr-manager.net/vacancies/list.aspx?_sp=3a6f.1535&amp;customer=nnit">N</a>'
'<a href="https://api.hr-manager.net/JobPortal.svc/flyingtiger/PositionList/rss/">R</a>'
'<a href="https://candidate.hr-manager.net/ApplicationInit.aspx?cid=1917">A</a>')
assert [(h, s) for h, s, _ in boards_in(page)] == [
("hrmanager", "seaborg_tr"), ("hrmanager", "kpmg"), ("hrmanager", "nnit"),
("hrmanager", "flyingtiger")]