Add a Watchlist tab for the companies the app cannot read a board of
Rate each one Yes or No apart from affinity, open its careers page with the time noted, and set a missing or wrong link in the row. Migration 15 adds companies.watch and careers_opened_at. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6f273cfdd6
commit
7dcb2c1705
11 files changed
+445
-12
No files matched your search
+50
-2
@@ -430,7 +430,8 @@ def test_companies_lists_board_and_open_role_count(
|
||||
assert row == {"key": "acme", "name": "Acme", "board": "greenhouse",
|
||||
"subscription_id": sub.id, "on": True, "affinity": 0, "open_roles": 1,
|
||||
"ats": "greenhouse", "ats_slug": "", "careers_url": "",
|
||||
"country": "DK", "failing_since": "", "failing_reason": "",
|
||||
"country": "DK", "city": "", "domain": "", "watch": None,
|
||||
"careers_opened_at": "", "failing_since": "", "failing_reason": "",
|
||||
"from_search": False}
|
||||
[other] = [c for c in res.json() if c["key"] == "other"]
|
||||
assert (other["board"], other["subscription_id"], other["on"], other["ats"]) == (
|
||||
@@ -552,6 +553,53 @@ def test_post_score_answers_with_the_job_to_wait_for(client: TestClient, queue:
|
||||
assert queue.jobs.get(res.json()["id"]).kind == "score"
|
||||
|
||||
|
||||
# ------------------------------------------------------------- watchlist
|
||||
|
||||
def test_the_watchlist_rating_is_global_and_leaves_affinity_alone(
|
||||
client: TestClient, store: Store) -> None:
|
||||
store.add_company("Acme", ats="workday")
|
||||
agent = store.save_agent("A")
|
||||
store.set_affinity(agent.id, "acme", 1)
|
||||
|
||||
for watch, stored in ((True, 1), (False, 0), (None, None)):
|
||||
res = client.post("/api/companies/acme/watch", json={"watch": watch})
|
||||
assert res.status_code == 200 and res.json()["watch"] == stored
|
||||
listed = client.get("/api/companies").json()[0]
|
||||
assert (listed["watch"], listed["affinity"]) == (stored, 1)
|
||||
|
||||
|
||||
def test_the_careers_page_is_set_cleared_and_must_be_a_web_address(
|
||||
client: TestClient, store: Store) -> None:
|
||||
store.add_company("Acme")
|
||||
|
||||
res = client.post("/api/companies/acme/careers", json={"careers_url": "https://a.example/jobs"})
|
||||
assert res.status_code == 200 and res.json()["careers_url"] == "https://a.example/jobs"
|
||||
for bad in ("javascript:alert(1)", "a.example/jobs", "ftp://a.example"):
|
||||
assert client.post("/api/companies/acme/careers",
|
||||
json={"careers_url": bad}).status_code == 422
|
||||
assert store.company("acme").careers_url == "https://a.example/jobs"
|
||||
cleared = client.post("/api/companies/acme/careers", json={"careers_url": ""})
|
||||
assert cleared.status_code == 200 and store.company("acme").careers_url == ""
|
||||
|
||||
|
||||
def test_opening_the_careers_page_stamps_the_time(client: TestClient, store: Store) -> None:
|
||||
store.add_company("Acme")
|
||||
assert client.get("/api/companies").json()[0]["careers_opened_at"] == ""
|
||||
|
||||
res = client.post("/api/companies/acme/opened")
|
||||
|
||||
assert res.status_code == 200
|
||||
assert res.json()["careers_opened_at"] == store.company("acme").careers_opened_at != ""
|
||||
assert client.get("/api/companies").json()[0]["careers_opened_at"] != ""
|
||||
|
||||
|
||||
def test_the_watchlist_endpoints_404_for_an_unknown_company(client: TestClient) -> None:
|
||||
assert client.post("/api/companies/nope/watch", json={"watch": True}).status_code == 404
|
||||
assert client.post("/api/companies/nope/careers",
|
||||
json={"careers_url": "https://a.example"}).status_code == 404
|
||||
assert client.post("/api/companies/nope/opened").status_code == 404
|
||||
|
||||
|
||||
# ----------------------------------------------------------- applications
|
||||
|
||||
def test_save_creates_an_application_with_a_saved_event(
|
||||
@@ -629,7 +677,7 @@ def test_the_applications_page_has_no_next_column(client: TestClient) -> None:
|
||||
# -------------------------------------------------------------------- tabs
|
||||
|
||||
def test_every_page_renders_with_the_whole_nav(client: TestClient) -> None:
|
||||
assert [t.label for t in TABS] == ["Roles", "Applications"]
|
||||
assert [t.label for t in TABS] == ["Roles", "Applications", "Watchlist"]
|
||||
assert [t.label for t in SETTINGS] == ["Search agents", "Sources", "Account"]
|
||||
assert all(t.path.startswith("/settings/") for t in SETTINGS)
|
||||
for tab in (*TABS, *SETTINGS):
|
||||
|
||||
Reference in new issue
Block a user