44
55# Third party imports
66from werkzeug .datastructures import FileStorage
7+ from flask import app
78
89# Local application imports
910from src .opengeodeweb_back import test_utils
@@ -174,12 +175,22 @@ def test_vertex_attribute_names(client):
174175 )
175176 assert response .status_code == 201
176177
178+ response = client .post (
179+ "/save_viewable_file" ,
180+ json = {
181+ "input_geode_object" : "PolygonalSurface3D" ,
182+ "filename" : "vertex_attribute.vtp" ,
183+ },
184+ )
185+ assert response .status_code == 200
186+ native_file_name = response .json ["native_file_name" ]
187+
177188 route = f"/vertex_attribute_names"
178189
179190 def get_full_data ():
180191 return {
181192 "input_geode_object" : "PolygonalSurface3D" ,
182- "filename" : "vertex_attribute.vtp" ,
193+ "filename" : native_file_name ,
183194 }
184195
185196 # Normal test with filename 'vertex_attribute.vtp'
@@ -200,12 +211,22 @@ def test_polygon_attribute_names(client):
200211 )
201212 assert response .status_code == 201
202213
214+ response = client .post (
215+ "/save_viewable_file" ,
216+ json = {
217+ "input_geode_object" : "PolygonalSurface3D" ,
218+ "filename" : "polygon_attribute.vtp" ,
219+ },
220+ )
221+ assert response .status_code == 200
222+ native_file_name = response .json ["native_file_name" ]
223+
203224 route = f"/polygon_attribute_names"
204225
205226 def get_full_data ():
206227 return {
207228 "input_geode_object" : "PolygonalSurface3D" ,
208- "filename" : "polygon_attribute.vtp" ,
229+ "filename" : native_file_name ,
209230 }
210231
211232 # Normal test with filename 'vertex_attribute.vtp'
@@ -220,6 +241,43 @@ def get_full_data():
220241 test_utils .test_route_wrong_params (client , route , get_full_data )
221242
222243
244+ def test_polyhedron_attribute_names (client ):
245+ response = client .put (
246+ f"/upload_file" ,
247+ data = {"file" : FileStorage (open ("./tests/polyhedron_attribute.vtu" , "rb" ))},
248+ )
249+ assert response .status_code == 201
250+
251+ response = client .post (
252+ "/save_viewable_file" ,
253+ json = {
254+ "input_geode_object" : "HybridSolid3D" ,
255+ "filename" : "polyhedron_attribute.vtu" ,
256+ },
257+ )
258+ assert response .status_code == 200
259+ native_file_name = response .json ["native_file_name" ]
260+
261+ route = f"/polyhedron_attribute_names"
262+
263+ def get_full_data ():
264+ return {
265+ "input_geode_object" : "HybridSolid3D" ,
266+ "filename" : native_file_name ,
267+ }
268+
269+ # Normal test with filename 'vertex_attribute.vtp'
270+ response = client .post (route , json = get_full_data ())
271+ assert response .status_code == 200
272+ polygon_attribute_names = response .json ["polyhedron_attribute_names" ]
273+ assert type (polygon_attribute_names ) is list
274+ for polygon_attribute_name in polygon_attribute_names :
275+ assert type (polygon_attribute_name ) is str
276+
277+ # Test all params
278+ test_utils .test_route_wrong_params (client , route , get_full_data )
279+
280+
223281def test_create_point (client ):
224282 route = f"/create_point"
225283 get_full_data = lambda : {"x" : 1 , "y" : 2 , "z" : 3 }
0 commit comments