Constrain selections to active work areas
This commit is contained in:
@@ -4,8 +4,8 @@ import uuid
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
|
||||
from geoalchemy2.shape import from_shape
|
||||
from shapely.geometry import Polygon
|
||||
from geoalchemy2.shape import from_shape, to_shape
|
||||
from shapely.geometry import Polygon, box
|
||||
|
||||
from app.core.errors import AppError
|
||||
from app.models import Dataset, VectorFeature
|
||||
@@ -176,7 +176,7 @@ def test_vector_select_route_uses_persisted_area_geometry_when_requested(monkeyp
|
||||
name="Regional vector",
|
||||
source_metadata={"selection_aggregation": {"method": "feature_count"}},
|
||||
)
|
||||
area_geometry = object()
|
||||
area_geometry = from_shape(box(5.0, 51.0, 5.3, 51.3), srid=4326)
|
||||
area = SimpleNamespace(id=area_id, project_id=project_id, geometry=area_geometry)
|
||||
captured: dict[str, object] = {}
|
||||
|
||||
@@ -226,9 +226,10 @@ def test_vector_select_route_uses_persisted_area_geometry_when_requested(monkeyp
|
||||
)
|
||||
|
||||
assert str(response["data"]["selection_area_id"]) == str(area_id)
|
||||
assert captured["select"]["selection_geometry"] is area_geometry
|
||||
assert to_shape(captured["select"]["selection_geometry"]).equals(box(5.0, 51.0, 5.2, 51.2))
|
||||
assert captured["select"]["selection_area_id"] == area_id
|
||||
assert captured["summary"]["selection_geometry"] is area_geometry
|
||||
assert to_shape(captured["summary"]["selection_geometry"]).equals(box(5.0, 51.0, 5.2, 51.2))
|
||||
assert captured["select"]["full_dataset_area"] is False
|
||||
|
||||
|
||||
def test_vector_select_route_rejects_area_from_another_project(monkeypatch) -> None:
|
||||
|
||||
Reference in New Issue
Block a user