feat: add gear provenance models and browser fetcher

This commit is contained in:
ik
2026-09-20 15:50:43 +07:00
parent b0edae98c6
commit 4e9895fbf4
19 changed files with 986 additions and 20 deletions
+16
View File
@@ -56,6 +56,22 @@ def test_failed_fetch_still_reserves_site_cooldown(tmp_path: Path, monkeypatch:
assert "rf4db.com" in json.loads(state_file.read_text(encoding="utf-8"))
def test_reserve_only_does_not_make_http_request(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str],
) -> None:
state_file = tmp_path / "fetch-state.json"
def fail(_url: str) -> str:
raise AssertionError("reserve-only must stop before HTTP")
monkeypatch.setattr(community_cli, "fetch_html", fail)
assert community_cli.main([
"rf4db-waterbodies", "--state-file", str(state_file), "--reserve-only",
]) == 0
payload = json.loads(capsys.readouterr().out)
assert payload == {"reserved": True, "source": "rf4db-waterbodies", "site_key": "rf4db.com"}
def test_detail_fetch_serializes_single_record(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str],
) -> None: