Skip to content

Commit 1e3a210

Browse files
committed
tests
1 parent a767553 commit 1e3a210

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tests/test_models_routes.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import os
22
import shutil
3-
import flask
43

54
from opengeodeweb_back import geode_functions
65
from opengeodeweb_microservice.database.data import Data
76
from opengeodeweb_microservice.database.connection import get_session
7+
from werkzeug.datastructures import FileStorage
88
import zipfile
99
import 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

138138
def 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

Comments
 (0)