Merge branch 'worktree-agent-ac3c9345edd29a1c6'
# Conflicts: # app/cli.py # app/jobs/sources.py # app/static/app.css # app/static/companies.js # app/web/api.py # tests/test_web.py
This commit is contained in:
commit
c6246af994
21 files changed
+1017
-155
No files matched your search
+30
-3
@@ -4,6 +4,7 @@ worker beyond starting and stopping it with the app."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from collections.abc import Iterator
|
||||
from datetime import UTC, datetime, timedelta
|
||||
from pathlib import Path
|
||||
@@ -396,7 +397,7 @@ 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"}
|
||||
"country": "DK", "failing_since": "", "failing_reason": ""}
|
||||
[other] = [c for c in res.json() if c["key"] == "other"]
|
||||
assert (other["board"], other["subscription_id"], other["on"], other["ats"]) == (
|
||||
"", None, None, "")
|
||||
@@ -405,6 +406,32 @@ def test_companies_lists_board_and_open_role_count(
|
||||
"", None, "successfactors", "https://novo.example/careers")
|
||||
|
||||
|
||||
def test_companies_say_since_when_a_board_fails(client: TestClient, store: Store,
|
||||
capsys: pytest.CaptureFixture[str],
|
||||
monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""What the pull recorded, on `/api/companies` and beside `app companies
|
||||
check`'s live result."""
|
||||
import plugins.ats as ats
|
||||
from app.cli import check_companies
|
||||
|
||||
store.add_subscription("ats", "greenhouse:acme", company="Acme", board="greenhouse")
|
||||
store.add_company("Acme", key="acme", ats="greenhouse")
|
||||
store.state["ats:failing:greenhouse:acme"] = json.dumps(
|
||||
{"since": "2026-09-01T06:00:00+00:00", "reason": "404 Not Found"})
|
||||
|
||||
[row] = client.get("/api/companies").json()
|
||||
assert (row["failing_since"], row["failing_reason"]) == (
|
||||
"2026-09-01T06:00:00+00:00", "404 Not Found")
|
||||
|
||||
monkeypatch.setattr(ats, "fetch_board", lambda target: ([{"source_id": "1"}], True))
|
||||
assert check_companies(store) == 0
|
||||
assert capsys.readouterr().out.splitlines() == [
|
||||
"greenhouse:acme (greenhouse:acme): now 1 roles; "
|
||||
"pull: failing since 2026-09-01: 404 Not Found",
|
||||
"checked 1 boards, 0 dead, 1 failing in the pull",
|
||||
]
|
||||
|
||||
|
||||
def test_set_affinity_validates_updates_and_enqueues_a_score(
|
||||
client: TestClient, store: Store, queue: Any) -> None:
|
||||
store.add_company("Acme", key="acme")
|
||||
@@ -913,7 +940,7 @@ def test_a_board_is_followed_only_if_it_answers(
|
||||
client: TestClient, store: Store, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
import plugins.ats as ats
|
||||
|
||||
monkeypatch.setattr(ats, "fetch_board", lambda target: [{"source_id": "1"}])
|
||||
monkeypatch.setattr(ats, "fetch_board", lambda target: ([{"source_id": "1"}], True))
|
||||
res = client.post("/api/boards", json={"board": "ashby:acme", "name": "Acme"})
|
||||
assert res.status_code == 201
|
||||
assert res.json()["found"] == 1 and res.json()["source"]["target"] == "ashby:acme"
|
||||
@@ -940,7 +967,7 @@ def test_a_companys_board_is_set_replaced_and_detached(
|
||||
client: TestClient, store: Store, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
import plugins.ats as ats
|
||||
|
||||
monkeypatch.setattr(ats, "fetch_board", lambda target: []) # between openings
|
||||
monkeypatch.setattr(ats, "fetch_board", lambda target: ([], True)) # between openings
|
||||
store.add_company("Acme", key="acme", ats="teamtailor", ats_slug="acme")
|
||||
|
||||
res = client.post("/api/companies/acme/board", json={"board": "greenhouse:acme"})
|
||||
|
||||
Reference in new issue
Block a user