Keep coverage materialization theme-specific
This commit is contained in:
@@ -423,6 +423,8 @@ class CoverageRegistryService:
|
||||
theme: str,
|
||||
zone: str,
|
||||
) -> list[Dataset]:
|
||||
if definition.operational_themes and theme not in definition.operational_themes:
|
||||
return []
|
||||
matches: list[Dataset] = []
|
||||
for dataset in datasets:
|
||||
if dataset.status != "ready" or dataset.source_name not in definition.materialized_source_names:
|
||||
|
||||
@@ -149,6 +149,37 @@ def test_coverage_resolver_only_reports_operational_for_materialized_ready_datas
|
||||
assert admin_item.materialized_dataset_ids == [dataset_id]
|
||||
|
||||
|
||||
def test_statbel_population_materialization_does_not_masquerade_as_admin_data() -> None:
|
||||
project_id = uuid4()
|
||||
statbel_id = uuid4()
|
||||
statbel = SimpleNamespace(
|
||||
id=statbel_id,
|
||||
status="ready",
|
||||
source_name="statbel",
|
||||
reference_layer_name="population",
|
||||
source_metadata={"coverage_zones": ["belgium", "flanders", "wallonia", "brussels"]},
|
||||
)
|
||||
result = CoverageRegistryService.resolve(
|
||||
FakeSession(
|
||||
project=SimpleNamespace(id=project_id),
|
||||
areas=[
|
||||
scope_area("Belgium land", box(2.5, 49.5, 6.4, 51.5)),
|
||||
scope_area("Flanders", box(2.5, 50.7, 5.9, 51.5)),
|
||||
],
|
||||
datasets=[statbel],
|
||||
),
|
||||
project_id,
|
||||
CoverageBBox(minx=4.9, miny=50.9, maxx=5.0, maxy=51.0),
|
||||
["admin", "population"],
|
||||
)
|
||||
|
||||
admin = next(item for item in result.items if item.theme == "admin")
|
||||
population = next(item for item in result.items if item.theme == "population")
|
||||
assert admin.materialized_dataset_ids == []
|
||||
assert population.status == "operational"
|
||||
assert population.materialized_dataset_ids == [statbel_id]
|
||||
|
||||
|
||||
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