fix manual parser refresh reliability
All checks were successful
CI/CD Pipeline / Quality Gate (push) Successful in 1m11s
CI/CD Pipeline / Build and Push Images (push) Successful in 21s
CI/CD Pipeline / Internal Notify (push) Successful in 0s
CI/CD Pipeline / Deploy Dev via Compose (push) Successful in 32s

This commit is contained in:
2026-08-10 15:02:00 +02:00
parent 61e178544b
commit 1c2dd985d4
6 changed files with 165 additions and 46 deletions

View File

@@ -49,6 +49,35 @@ class GispProductsClientTest(SimpleTestCase):
):
GispProductsClient(max_records=10_001)
def test_retries_transient_server_error(self):
calls = 0
def handle_page(_request, _body: bytes) -> Response:
nonlocal calls
calls += 1
if calls == 1:
return Response(status=504, body=b"gateway timeout")
return Response(
body=b'{"ok":true,"total_count":1,"items":[]}',
headers={"Content-Type": "application/json"},
)
with HTTPTestServer() as server:
server.add_route("POST", "/pp719v2/pub/prod/b/", handle_page)
client = GispProductsClient(
base_url=server.base_url,
max_pages=1,
retry_backoff_seconds=0,
http_adapter=server.adapter,
)
with self.assertRaisesMessage(
GispProductsClientError,
"empty page before total_count",
):
client.fetch_products()
self.assertEqual(calls, 2)
def test_fetch_products_follows_skip_pagination_and_maps_items(self):
requests: list[dict] = []