Fail the read when Lever answers something other than a list or Oracle an answer without its search wrapper, instead of reading an empty board that is complete
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
19fb73caa0
commit
85aed0807b
4 files changed
+67
-5
No files matched your search
@@ -165,6 +165,28 @@ def test_an_empty_board_is_complete(monkeypatch: pytest.MonkeyPatch, no_delay: N
|
||||
assert ats._fetch_rows(object(), f"oracle:{SLUG}") == ([], True) # type: ignore[arg-type]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("answer", [
|
||||
{}, {"items": []}, {"items": {}}, {"items": [None]}, [], {"title": "Unauthorized"}])
|
||||
def test_an_answer_without_the_search_wrapper_fails_the_read(
|
||||
monkeypatch: pytest.MonkeyPatch, no_delay: None, answer: Any) -> None:
|
||||
"""It used to read as an empty last page with no total: a complete
|
||||
read of a board with no roles."""
|
||||
monkeypatch.setattr(ats, "_get", lambda *a, **k: json.dumps(answer).encode())
|
||||
with pytest.raises(ValueError, match="no search wrapper in items"):
|
||||
ats._fetch_rows(object(), f"oracle:{SLUG}") # type: ignore[arg-type]
|
||||
|
||||
|
||||
def test_a_board_answering_without_the_wrapper_is_recorded_failing(
|
||||
monkeypatch: pytest.MonkeyPatch, no_delay: None) -> None:
|
||||
monkeypatch.setattr(ats, "_get", lambda *a, **k: b'{"title": "Unauthorized"}')
|
||||
source = ats.ATSSource({"boards": [{"url": f"oracle:{SLUG}", "label": "Nokia",
|
||||
"params": {}}], "run": "r"})
|
||||
source.state = {}
|
||||
assert list(source.fetch()) == []
|
||||
assert f"ats:ok:oracle:{SLUG}" not in source.state
|
||||
assert "no search wrapper" in json.loads(source.state[f"ats:failing:oracle:{SLUG}"])["reason"]
|
||||
|
||||
|
||||
# ----------------------------------------------------------------- detail
|
||||
|
||||
def _detail_get(body: bytes, asked: list[str]) -> Any:
|
||||
|
||||
Reference in new issue
Block a user