11import os
22import shutil
3- import flask
43
54from opengeodeweb_back import geode_functions
65from opengeodeweb_microservice .database .data import Data
76from opengeodeweb_microservice .database .connection import get_session
7+ from werkzeug .datastructures import FileStorage
88import zipfile
99import json
1010
@@ -60,7 +60,7 @@ def test_export_project_route(client, tmp_path):
6060 snapshot = {
6161 "styles" : {"1" : {"visibility" : True , "opacity" : 1.0 , "color" : [0.2 , 0.6 , 0.9 ]}}
6262 }
63- filename = "export_project_test.zip "
63+ filename = "export_project_test.vease "
6464 project_folder = client .application .config ["DATA_FOLDER_PATH" ]
6565 os .makedirs (project_folder , exist_ok = True )
6666 database_root_path = os .path .join (project_folder , "project.db" )
@@ -109,15 +109,15 @@ def test_import_project_route(client, tmp_path):
109109 conn .commit ()
110110 conn .close ()
111111
112- z = tmp_path / "import_project_test.zip "
112+ z = tmp_path / "import_project_test.vease "
113113 with zipfile .ZipFile (z , "w" , compression = zipfile .ZIP_DEFLATED ) as zipf :
114114 zipf .writestr ("snapshot.json" , json .dumps (snapshot ))
115115 zipf .write (str (temp_db ), "project.db" )
116116
117117 with open (z , "rb" ) as f :
118118 resp = client .post (
119119 route ,
120- data = {"file" : (f , "import_project_test.zip " )},
120+ data = {"file" : (f , "import_project_test.vease " )},
121121 content_type = "multipart/form-data" ,
122122 )
123123
@@ -136,6 +136,13 @@ def test_import_project_route(client, tmp_path):
136136
137137
138138def test_save_viewable_workflow_from_file (client ):
139+ file = os .path .join (data_dir , "cube.og_brep" )
140+ upload_resp = client .put (
141+ "/opengeodeweb_back/upload_file" ,
142+ data = {"file" : FileStorage (open (file , "rb" ))},
143+ )
144+ assert upload_resp .status_code == 201
145+
139146 route = "/opengeodeweb_back/save_viewable_file"
140147 payload = {"input_geode_object" : "BRep" , "filename" : "cube.og_brep" }
141148
0 commit comments