Harden register pagination and Mol source selection
This commit is contained in:
@@ -111,21 +111,25 @@ class OfficialResponse:
|
||||
class TwoPageOfficialSession:
|
||||
def __init__(self):
|
||||
self.calls = 0
|
||||
self.params = []
|
||||
|
||||
def get(self, url, *, params, timeout): # noqa: ANN001, ARG002
|
||||
self.calls += 1
|
||||
self.params.append(params)
|
||||
if self.calls == 1:
|
||||
payload = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [building_feature("1", box(5.10, 51.20, 5.101, 51.201))],
|
||||
"links": [{"rel": "next", "href": f"{url}?startIndex=1"}],
|
||||
}
|
||||
else:
|
||||
elif self.calls == 2:
|
||||
payload = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [building_feature("2", box(5.102, 51.20, 5.103, 51.201))],
|
||||
"links": [],
|
||||
}
|
||||
else:
|
||||
payload = {"type": "FeatureCollection", "features": [], "links": []}
|
||||
return OfficialResponse(payload, f"{url}?page={self.calls}")
|
||||
|
||||
|
||||
@@ -157,7 +161,9 @@ def test_official_collection_pagination_retains_checksummed_pages(tmp_path: Path
|
||||
)
|
||||
|
||||
assert [feature["properties"]["ObjectId"] for feature in features] == [1, 2]
|
||||
assert summary["page_count"] == 2
|
||||
assert summary["page_count"] == 3
|
||||
assert summary["pagination_fallback_count"] == 1
|
||||
assert session.params[2]["startIndex"] == "2"
|
||||
assert all((tmp_path / page["path"]).is_file() for page in summary["pages"])
|
||||
assert all(len(page["sha256"]) == 64 for page in summary["pages"])
|
||||
|
||||
@@ -351,6 +357,7 @@ def test_operator_is_canonical_packaged_and_mol_scoped_in_explorer() -> None:
|
||||
assert "COPY scripts/provision_buildings_addresses_register.py" in dockerfile
|
||||
assert "py_compile scripts/provision_buildings_addresses_register.py" in readiness
|
||||
assert "datasetCoversSelectedArea" in workspace
|
||||
assert "digitaal_vlaanderen_buildings_addresses_register' ? 1_200_000" in workspace
|
||||
assert "Gebouwen- en Adressenregister" in catalog
|
||||
assert "building_registry: 'Gebouwenregister'" in display
|
||||
assert "digitaal_vlaanderen_buildings_addresses_register: 'Digitaal Vlaanderen'" in display
|
||||
|
||||
Reference in New Issue
Block a user