fix: close Walloon terrain provisioning
This commit is contained in:
@@ -102,11 +102,23 @@ def make_source(path: Path) -> list[float]:
|
||||
return [min_lon, min_lat, max_lon, max_lat]
|
||||
|
||||
|
||||
def write_source_checksum(source_dir: Path) -> str:
|
||||
digest = "a" * 64
|
||||
(source_dir / SpwTerrainService.SOURCE_SHA256_FILENAME).write_text(
|
||||
f"{digest} {SpwTerrainService.SOURCE_FILENAME}\n", encoding="ascii"
|
||||
)
|
||||
return digest
|
||||
|
||||
|
||||
def test_spw_terrain_registry_reports_real_source_state(tmp_path: Path) -> None:
|
||||
before = SpwTerrainService.list_products(settings=settings(tmp_path))[0]
|
||||
assert before["status"] == "source_not_provisioned"
|
||||
|
||||
make_source(tmp_path / SpwTerrainService.SOURCE_FILENAME)
|
||||
without_checksum = SpwTerrainService.list_products(settings=settings(tmp_path))[0]
|
||||
assert without_checksum["configured"] is False
|
||||
|
||||
write_source_checksum(tmp_path)
|
||||
after = SpwTerrainService.list_products(settings=settings(tmp_path))[0]
|
||||
|
||||
assert after["configured"] is True
|
||||
@@ -119,6 +131,7 @@ def test_spw_terrain_acquisition_persists_bounded_dng_raster_and_provenance(
|
||||
tmp_path: Path, monkeypatch
|
||||
) -> None:
|
||||
bbox = make_source(tmp_path / SpwTerrainService.SOURCE_FILENAME)
|
||||
source_digest = write_source_checksum(tmp_path)
|
||||
project = Project(id=uuid4(), name="Belgium")
|
||||
captured = {}
|
||||
|
||||
@@ -150,6 +163,8 @@ def test_spw_terrain_acquisition_persists_bounded_dng_raster_and_provenance(
|
||||
assert captured["source_metadata"]["vertical_unit_label"] == "m DNG"
|
||||
assert captured["source_metadata"]["coverage_zones"] == ["wallonia"]
|
||||
assert captured["provenance_metadata"]["resampling"] == "bilinear"
|
||||
assert captured["provenance_metadata"]["source_sha256"] == source_digest
|
||||
assert captured["temporal_granularity"] == "period"
|
||||
assert captured["valid_from"].date().isoformat() == "2021-02-19"
|
||||
with rasterio.MemoryFile(captured["content"]) as memory:
|
||||
with memory.open() as derived:
|
||||
|
||||
Reference in New Issue
Block a user