Repository: camptocamp/python-geoservercloud

Issue:
FeatureType BBOX not synched when copying a workspace
The BBOX of the FeatureTypes are not synched when copying a workspace.

To reproduce:
- create a layer on geoserverA with a BBOX computed from SRS
- copy it to geoserverB

the new created featureType should have the same the same BBOX as the original, but instead it has BBOX computed from data

Discussion:

Patch:
diff --git a/geoservercloud/models/featuretype.py b/geoservercloud/models/featuretype.py
index ea35a47..2b761d4 100644
--- a/geoservercloud/models/featuretype.py
+++ b/geoservercloud/models/featuretype.py
@@ -140,6 +140,8 @@ class FeatureType(EntityModel):
             projection_policy=feature_type["projectionPolicy"],
             service_configuration=feature_type["serviceConfiguration"],
             advertised=feature_type.get("advertised"),
+            native_bounding_box=feature_type.get("nativeBoundingBox"),
+            lat_lon_bounding_box=feature_type.get("latLonBoundingBox"),
             encode_measures=feature_type.get("encodeMeasures"),
             forced_decimals=feature_type.get("forcedDecimals"),
             simple_conversion_enabled=feature_type.get("simpleConversionEnabled"),


Test patch:
diff --git a/tests/models/test_featuretype.py b/tests/models/test_featuretype.py
index 1a7364e..100a112 100644
--- a/tests/models/test_featuretype.py
+++ b/tests/models/test_featuretype.py
@@ -134,7 +134,21 @@ def test_featuretype_from_get_response_payload():
             "enabled": True,
             "advertised": True,
             "projectionPolicy": "FORCE_DECLARED",
-            "srs": "EPSG:4326",
+            "srs": "EPSG:2056",
+            "nativeBoundingBox": {
+                "minx": 2485014.052451379,
+                "maxx": 2837016.9329778464,
+                "miny": 1074188.6943776933,
+                "maxy": 1299782.763494124,
+                "crs": {"@class": "projected", "$": "EPSG:2056"},
+            },
+            "latLonBoundingBox": {
+                "minx": 5.902662003204146,
+                "maxx": 10.603307860867739,
+                "miny": 45.7779277267225,
+                "maxy": 47.8485348773655,
+                "crs": "EPSG:4326",
+            },
             "title": "Test Title",
             "abstract": "Test Abstract",
             "keywords": {"string": ["keyword1", "keyword2"]},
@@ -176,7 +190,21 @@ def test_featuretype_from_get_response_payload():
     assert feature_type.native_name == "test_native_name"
     assert feature_type.store_name == "test_store"
     assert feature_type.workspace_name == "test_workspace"
-    assert feature_type.srs == "EPSG:4326"
+    assert feature_type.srs == "EPSG:2056"
+    assert feature_type.native_bounding_box == {
+        "minx": 2485014.052451379,
+        "maxx": 2837016.9329778464,
+        "miny": 1074188.6943776933,
+        "maxy": 1299782.763494124,
+        "crs": {"@class": "projected", "$": "EPSG:2056"},
+    }
+    assert feature_type.lat_lon_bounding_box == {
+        "minx": 5.902662003204146,
+        "maxx": 10.603307860867739,
+        "miny": 45.7779277267225,
+        "maxy": 47.8485348773655,
+        "crs": "EPSG:4326",
+    }
     assert feature_type.title.asdict()["title"] == "Test Title"
     assert feature_type.abstract.asdict()["abstract"] == "Test Abstract"
     assert feature_type.keywords == ["keyword1", "keyword2"]