@@ -14,6 +14,15 @@ def point_data() -> test_utils.JsonData:
1414 return {"name" : "test_point" , "points" : [{"x" : 1.0 , "y" : 2.0 , "z" : 3.0 }]}
1515
1616
17+ @pytest .fixture
18+ def curve_data () -> test_utils .JsonData :
19+ return {
20+ "name" : "test_curve" ,
21+ "points" : [{"x" : 0.0 , "y" : 0.0 , "z" : 0.0 }, {"x" : 1.0 , "y" : 1.0 , "z" : 1.0 }],
22+ "edges" : [[0 , 1 ]],
23+ }
24+
25+
1726def test_create_point (client : FlaskClient , point_data : test_utils .JsonData ) -> None :
1827 """Test the creation of a point with valid data."""
1928 route : str = "/opengeodeweb_back/create/point_set"
@@ -74,3 +83,28 @@ def test_create_point_with_invalid_data(client: FlaskClient) -> None:
7483 invalid_data = {"name" : "invalid_point" , "points" : [{"y" : 2.0 , "z" : 3.0 }]}
7584 response = client .post (route , json = invalid_data )
7685 assert response .status_code == 400
86+
87+
88+ def test_create_curve (client : FlaskClient , curve_data : test_utils .JsonData ) -> None :
89+ """Test the creation of a curve with valid data."""
90+ route : str = "/opengeodeweb_back/create/edged_curve"
91+
92+ # Test with all required data
93+ response = client .post (route , json = curve_data )
94+ assert response .status_code == 200
95+
96+ # Verify response data
97+ response_data = response .get_json ()
98+ assert "viewable_file" in response_data
99+ assert "id" in response_data
100+ assert "name" in response_data
101+ assert "native_file" in response_data
102+ assert "viewer_type" in response_data
103+ assert "geode_object_type" in response_data
104+
105+ assert response_data ["name" ] == curve_data ["name" ]
106+ assert response_data ["viewer_type" ] == "mesh"
107+ assert response_data ["geode_object_type" ] == "EdgedCurve3D"
108+
109+ # Test with missing parameters
110+ test_utils .test_route_wrong_params (client , route , lambda : copy .deepcopy (curve_data ))
0 commit comments