fix: paginate official land-use workspace lookup
This commit is contained in:
@@ -141,6 +141,41 @@ def test_official_landuse_metadata_keeps_modern_series_separate(tmp_path: Path)
|
||||
assert "historical-landuse" not in module.series_key(theme, "mol")
|
||||
|
||||
|
||||
def test_official_landuse_operator_paginates_within_api_limit() -> None:
|
||||
module = load_provisioner()
|
||||
|
||||
class Response:
|
||||
ok = True
|
||||
status_code = 200
|
||||
text = ""
|
||||
|
||||
def __init__(self, payload):
|
||||
self.payload = payload
|
||||
|
||||
def json(self):
|
||||
return {"data": self.payload}
|
||||
|
||||
class Session:
|
||||
def __init__(self) -> None:
|
||||
self.calls = []
|
||||
|
||||
def get(self, url, *, params, timeout):
|
||||
self.calls.append((url, params, timeout))
|
||||
offset = params["offset"]
|
||||
page_items = [{"id": index} for index in range(offset, min(offset + 200, 405))]
|
||||
return Response({"items": page_items, "total": 405, "limit": 200, "offset": offset})
|
||||
|
||||
session = Session()
|
||||
items = module.list_paginated_items(session, "http://backend/api/v1/projects", timeout=30)
|
||||
|
||||
assert len(items) == 405
|
||||
assert [call[1] for call in session.calls] == [
|
||||
{"limit": 200, "offset": 0},
|
||||
{"limit": 200, "offset": 200},
|
||||
{"limit": 200, "offset": 400},
|
||||
]
|
||||
|
||||
|
||||
def test_official_landuse_operator_is_packaged_and_readiness_checked() -> None:
|
||||
readiness = (ROOT / "scripts/run_readiness_check.sh").read_text(encoding="utf-8")
|
||||
dockerfile = (ROOT / "deploy/unraid/Dockerfile.all-in-one").read_text(encoding="utf-8")
|
||||
|
||||
Reference in New Issue
Block a user