@@ -23,6 +23,20 @@ def curve_data() -> test_utils.JsonData:
2323 }
2424
2525
26+ @pytest .fixture
27+ def surface_data () -> test_utils .JsonData :
28+ return {
29+ "name" : "test_surface" ,
30+ "points" : [
31+ {"x" : 0.0 , "y" : 0.0 , "z" : 0.0 },
32+ {"x" : 1.0 , "y" : 0.0 , "z" : 0.0 },
33+ {"x" : 1.0 , "y" : 1.0 , "z" : 0.0 },
34+ {"x" : 0.0 , "y" : 1.0 , "z" : 0.0 },
35+ ],
36+ "polygons" : [[0 , 1 , 2 , 3 ]],
37+ }
38+
39+
2640def test_create_point (client : FlaskClient , point_data : test_utils .JsonData ) -> None :
2741 """Test the creation of a point with valid data."""
2842 route : str = "/opengeodeweb_back/create/point_set"
@@ -108,3 +122,32 @@ def test_create_curve(client: FlaskClient, curve_data: test_utils.JsonData) -> N
108122
109123 # Test with missing parameters
110124 test_utils .test_route_wrong_params (client , route , lambda : copy .deepcopy (curve_data ))
125+
126+
127+ def test_create_polygonal_surface (
128+ client : FlaskClient , surface_data : test_utils .JsonData
129+ ) -> None :
130+ """Test the creation of a polygonal surface with valid data."""
131+ route : str = "/opengeodeweb_back/create/polygonal_surface"
132+
133+ # Test with all required data
134+ response = client .post (route , json = surface_data )
135+ assert response .status_code == 200
136+
137+ # Verify response data
138+ response_data = response .get_json ()
139+ assert "viewable_file" in response_data
140+ assert "id" in response_data
141+ assert "name" in response_data
142+ assert "native_file" in response_data
143+ assert "viewer_type" in response_data
144+ assert "geode_object_type" in response_data
145+
146+ assert response_data ["name" ] == surface_data ["name" ]
147+ assert response_data ["viewer_type" ] == "mesh"
148+ assert response_data ["geode_object_type" ] == "PolygonalSurface3D"
149+
150+ # Test with missing parameters
151+ test_utils .test_route_wrong_params (
152+ client , route , lambda : copy .deepcopy (surface_data )
153+ )
0 commit comments