Harden DHMV WCS request headers
GeoIntel CI / docs-smoke (push) Canceled after 0s
GeoIntel CI / contract-smoke (push) Canceled after 0s

This commit is contained in:
Codex
2026-07-15 18:54:31 +02:00
parent daf9cef01b
commit 705dfad4f1
2 changed files with 29 additions and 1 deletions
@@ -200,6 +200,28 @@ def test_dhmv_multipart_geotiff_is_extracted_and_invalid_response_fails_closed()
assert exc_info.value.code == "DHMV_PROVIDER_INVALID_RESPONSE"
def test_dhmv_fetch_sends_explicit_accept_header_required_by_official_wcs() -> None:
observed_headers: dict[str, str | None] = {}
def opener(request, **_kwargs):
observed_headers["accept"] = request.get_header("Accept")
observed_headers["user_agent"] = request.get_header("User-agent")
return FakeResponse(b"II*\x00test", "image/tiff")
content, content_type = DhmvAcquisitionService._fetch(
"https://geo.api.vlaanderen.be/DHMV/wcs?bounded=true",
Settings(_env_file=None),
opener,
)
assert content == b"II*\x00test"
assert content_type == "image/tiff"
assert observed_headers == {
"accept": "*/*",
"user_agent": "GeoIntel/0.1 bounded-dhmv-acquisition",
}
def test_dhmv_acquisition_clips_validates_and_persists_via_dataset_service(tmp_path) -> None:
project_id = uuid4()
area_id = uuid4()