feat: expose explicit source conflicts
This commit is contained in:
@@ -55,6 +55,20 @@ def test_activity_filters_and_explains_score() -> None:
|
||||
assert payload["items"][0]["unique_players"] == 3
|
||||
assert "3 свежих улова" in payload["items"][0]["explanation"]
|
||||
assert payload["items"][0]["sources"] == ["manual-import"]
|
||||
assert payload["items"][0]["source_conflicts"] == []
|
||||
|
||||
|
||||
def test_explicit_source_conflict_is_exposed_on_activity_and_spot() -> None:
|
||||
with Session(engine) as db:
|
||||
report = db.scalar(select(CatchReport).where(CatchReport.waterbody.has(slug="test-lake")))
|
||||
assert report is not None
|
||||
report.raw_payload = {"provenance": {"conflicts": ["координаты: 10:20 · 11:21"]}}
|
||||
spot_id = report.spot_id
|
||||
db.commit()
|
||||
activity = client.get("/api/v1/activity?waterbody=test-lake&fish=pike&hours=6").json()
|
||||
assert activity["items"][0]["source_conflicts"] == ["координаты: 10:20 · 11:21"]
|
||||
spot = client.get(f"/api/v1/spots/{spot_id}").json()
|
||||
assert spot["source_conflicts"] == ["координаты: 10:20 · 11:21"]
|
||||
|
||||
|
||||
def test_waterbody_catalog_exposes_nullable_source_provenance() -> None:
|
||||
|
||||
Reference in New Issue
Block a user