@@ -121,3 +121,50 @@ def test_import_project_route(client, tmp_path):
121121 assert os .path .exists (pre_existing_db_path )
122122 with open (pre_existing_db_path , "rb" ) as file :
123123 assert file .read () == new_database_bytes
124+
125+
126+ def test_save_viewable_workflow_from_file (client ):
127+ route = "/opengeodeweb_back/save_viewable_file"
128+ payload = {"input_geode_object" : "BRep" , "filename" : "cube.og_brep" }
129+
130+ response = client .post (route , json = payload )
131+ assert response .status_code == 200
132+
133+ data_id = response .json ["id" ]
134+ assert isinstance (data_id , str ) and len (data_id ) > 0
135+ assert response .json ["viewable_file_name" ].endswith (".vtm" )
136+
137+ comp_resp = client .post (
138+ "/opengeodeweb_back/models/vtm_component_indices" , json = {"id" : data_id }
139+ )
140+ assert comp_resp .status_code == 200
141+
142+ refreshed = Data .get (data_id )
143+ assert refreshed is not None
144+
145+
146+ def test_save_viewable_workflow_from_object (client ):
147+ # Chemin “from object” : passe par un endpoint de création qui génère/sauvegarde via save_viewable.
148+ route = "/opengeodeweb_back/create/create_aoi"
149+ aoi_data = {
150+ "name" : "workflow_aoi" ,
151+ "points" : [
152+ {"x" : 0.0 , "y" : 0.0 },
153+ {"x" : 1.0 , "y" : 0.0 },
154+ {"x" : 1.0 , "y" : 1.0 },
155+ {"x" : 0.0 , "y" : 1.0 },
156+ ],
157+ "z" : 0.0 ,
158+ }
159+
160+ response = client .post (route , json = aoi_data )
161+ assert response .status_code == 200
162+
163+ data_id = response .json ["id" ]
164+ assert isinstance (data_id , str ) and len (data_id ) > 0
165+ assert response .json ["geode_object" ] == "EdgedCurve3D"
166+ assert response .json ["viewable_file_name" ].endswith (".vtp" )
167+
168+ attr_resp = client .post ("/opengeodeweb_back/vertex_attribute_names" , json = {"id" : data_id })
169+ assert attr_resp .status_code == 200
170+ assert isinstance (attr_resp .json .get ("vertex_attribute_names" , []), list )
0 commit comments