Skip to content

Commit

Permalink
[Fixes #12763] 3D tiles geometricError mandatory field should be on t…
Browse files Browse the repository at this point in the history
…ileset level (#12764)

* [Fixes #12763] 3D tiles geometricError mandatory field should be on tileset level

* [Fixes #12763] 3D tiles geometricError mandatory field should be on tileset level

* [Fixes #12763] 3D tiles geometricError mandatory field should be on tileset level
  • Loading branch information
mattiagiupponi authored Dec 2, 2024
1 parent 051efdd commit eb35218
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion geonode/upload/handlers/tiles3d/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def validate_3dtile_payload(payload):
if not volume:
raise Invalid3DTilesException("The mandatory 'boundingVolume' for the key 'root' is missing")

error = payload.get("root", {}).get("geometricError", None)
error = payload.get("geometricError", None) or payload.get("root", {}).get("geometricError", None)
if error is None:
raise Invalid3DTilesException("The mandatory 'geometricError' for the key 'root' is missing")

Expand Down
6 changes: 4 additions & 2 deletions geonode/upload/handlers/tiles3d/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ def test_validate_should_raise_exception_for_invalid_root_boundingVolume(self):
def test_validate_should_raise_exception_for_invalid_root_geometricError(self):
_json = {
"asset": {"version": "1.1"},
"geometricError": 1.0,
"root": {"boundingVolume": {"box": []}, "foo": 0.0},
}
_path = "/tmp/tileset.json"
Expand All @@ -164,7 +163,10 @@ def test_validate_should_raise_exception_for_invalid_root_geometricError(self):
self.handler.is_valid(files={"base_file": _path}, user=self.user)

self.assertIsNotNone(_exc)
self.assertTrue("The mandatory 'geometricError' for the key 'root' is missing" in str(_exc.exception.detail))
self.assertTrue(
"The provided 3DTiles is not valid, some of the mandatory keys are missing. Mandatory keys are: 'asset', 'geometricError', 'root'"
in str(_exc.exception.detail)
)
os.remove(_path)

def test_get_ogr2ogr_driver_should_return_the_expected_driver(self):
Expand Down
2 changes: 1 addition & 1 deletion geonode/upload/tests/end2end/test_end2end.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def test_import_wms(self):
"parse_remote_metadata": True,
"action": "upload",
}
initial_name = res.title
initial_name = res.title.lower().replace(" ", "_")
assert_payload = {
"subtype": "remote",
"title": res.title,
Expand Down

0 comments on commit eb35218

Please sign in to comment.