Fix regional flood area pagination
This commit is contained in:
@@ -42,9 +42,11 @@ class FakeSession:
|
||||
def __init__(self, module):
|
||||
self.module = module
|
||||
self.posts: list[tuple[str, dict[str, Any]]] = []
|
||||
self.gets: list[tuple[str, dict[str, Any]]] = []
|
||||
self.headers: dict[str, str] = {}
|
||||
|
||||
def get(self, url: str, **_kwargs):
|
||||
def get(self, url: str, **kwargs):
|
||||
self.gets.append((url, kwargs.get("params") or {}))
|
||||
if url.endswith("/api/v1/projects"):
|
||||
return FakeResponse({"data": {"items": [{"id": "project-1", "name": "Kempen Regional Workbench"}]}})
|
||||
if url.endswith("/areas"):
|
||||
@@ -67,7 +69,10 @@ class FakeSession:
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"total": 1,
|
||||
"limit": kwargs.get("params", {}).get("limit", 50),
|
||||
"offset": kwargs.get("params", {}).get("offset", 0),
|
||||
}
|
||||
)
|
||||
if url.endswith("/datasets/flood-hazard/products"):
|
||||
@@ -137,6 +142,7 @@ def test_regional_flood_operator_dry_run_uses_canonical_registry(monkeypatch, ca
|
||||
assert '"status": "dry_run"' in output
|
||||
assert '"planned_acquisitions": 1' in output
|
||||
assert fake_session.posts == []
|
||||
assert any(params.get("limit") == 200 for url, params in fake_session.gets if url.endswith("/areas"))
|
||||
|
||||
|
||||
def test_regional_flood_operator_calls_acquisition_and_selection(monkeypatch, capsys) -> None:
|
||||
|
||||
Reference in New Issue
Block a user