Scope bounded coverage to persisted extents
This commit is contained in:
@@ -180,6 +180,47 @@ def test_statbel_population_materialization_does_not_masquerade_as_admin_data()
|
||||
assert population.materialized_dataset_ids == [statbel_id]
|
||||
|
||||
|
||||
def test_bounded_api_materialization_only_covers_its_persisted_bbox() -> None:
|
||||
project_id = uuid4()
|
||||
dataset_id = uuid4()
|
||||
dataset = SimpleNamespace(
|
||||
id=dataset_id,
|
||||
status="ready",
|
||||
source_name="spw_picc",
|
||||
reference_layer_name="buildings",
|
||||
source_metadata={
|
||||
"coverage_zones": ["wallonia"],
|
||||
"bbox_epsg4326": [4.55, 50.58, 4.56, 50.59],
|
||||
},
|
||||
)
|
||||
session = FakeSession(
|
||||
project=SimpleNamespace(id=project_id),
|
||||
areas=[
|
||||
scope_area("Belgium land", box(2.5, 49.5, 6.4, 51.5)),
|
||||
scope_area("Wallonia", box(2.5, 49.5, 6.4, 50.8)),
|
||||
],
|
||||
datasets=[dataset],
|
||||
)
|
||||
|
||||
inside = CoverageRegistryService.resolve(
|
||||
session,
|
||||
project_id,
|
||||
CoverageBBox(minx=4.551, miny=50.581, maxx=4.559, maxy=50.589),
|
||||
["buildings"],
|
||||
)
|
||||
outside = CoverageRegistryService.resolve(
|
||||
session,
|
||||
project_id,
|
||||
CoverageBBox(minx=4.7, miny=50.6, maxx=4.71, maxy=50.61),
|
||||
["buildings"],
|
||||
)
|
||||
|
||||
assert inside.items[0].status == "operational"
|
||||
assert inside.items[0].materialized_dataset_ids == [dataset_id]
|
||||
assert outside.items[0].status == "partial"
|
||||
assert outside.items[0].materialized_dataset_ids == []
|
||||
|
||||
|
||||
def test_mixed_land_and_north_sea_selection_remains_split() -> None:
|
||||
project_id = uuid4()
|
||||
project = SimpleNamespace(id=project_id)
|
||||
|
||||
Reference in New Issue
Block a user