Skip to content

Commit 7d98acc

Browse files
MaxNumeriquegithub-actions[bot]
authored andcommitted
Apply prepare changes
1 parent 38ed9d7 commit 7d98acc

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/opengeodeweb_back/routes/blueprint_routes.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -390,19 +390,15 @@ def import_project() -> flask.Response:
390390
if os.path.isfile(vpath):
391391
continue
392392

393-
394393
input_file = str(data_entry.input_file or "")
395394
if not input_file:
396395
continue
397396

398-
399397
input_full = geode_functions.data_file_path(data_entry.id, input_file)
400398
if not os.path.isfile(input_full):
401399
continue
402400

403-
data_object = geode_functions.load(
404-
data_entry.geode_object, input_full
405-
)
401+
data_object = geode_functions.load(data_entry.geode_object, input_full)
406402
utils_functions.save_all_viewables_and_return_info(
407403
data_entry.geode_object, data_object, data_entry, data_path
408404
)

tests/test_models_routes.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,20 +92,26 @@ def test_export_project_route(client, tmp_path):
9292

9393
def test_import_project_route(client, tmp_path):
9494
route = "/opengeodeweb_back/import_project"
95-
snapshot = {"styles": {"1": {"visibility": True, "opacity": 1.0, "color": [0.2, 0.6, 0.9]}}}
95+
snapshot = {
96+
"styles": {"1": {"visibility": True, "opacity": 1.0, "color": [0.2, 0.6, 0.9]}}
97+
}
9698

9799
original_data_folder = client.application.config["DATA_FOLDER_PATH"]
98-
client.application.config["DATA_FOLDER_PATH"] = os.path.join(str(tmp_path), "project_data")
100+
client.application.config["DATA_FOLDER_PATH"] = os.path.join(
101+
str(tmp_path), "project_data"
102+
)
99103
db_path = os.path.join(client.application.config["DATA_FOLDER_PATH"], "project.db")
100104

101105
import sqlite3, zipfile, json
106+
102107
temp_db = tmp_path / "temp_project.db"
103108
conn = sqlite3.connect(str(temp_db))
104109
conn.execute(
105110
"CREATE TABLE datas (id TEXT PRIMARY KEY, geode_object TEXT, viewer_object TEXT, native_file_name TEXT, "
106111
"viewable_file_name TEXT, light_viewable TEXT, input_file TEXT, additional_files TEXT)"
107112
)
108-
conn.commit(); conn.close()
113+
conn.commit()
114+
conn.close()
109115

110116
z = tmp_path / "import_project_test.zip"
111117
with zipfile.ZipFile(z, "w", compression=zipfile.ZIP_DEFLATED) as zipf:
@@ -114,21 +120,25 @@ def test_import_project_route(client, tmp_path):
114120

115121
with open(z, "rb") as f:
116122
resp = client.post(
117-
route, data={"file": (f, "import_project_test.zip")}, content_type="multipart/form-data"
123+
route,
124+
data={"file": (f, "import_project_test.zip")},
125+
content_type="multipart/form-data",
118126
)
119127

120128
assert resp.status_code == 200
121129
assert resp.json.get("snapshot") == snapshot
122130
assert os.path.exists(db_path)
123131

124132
from opengeodeweb_microservice.database import connection
133+
125134
client.application.config["DATA_FOLDER_PATH"] = original_data_folder
126135
test_db_path = os.environ.get("TEST_DB_PATH")
127136
if test_db_path:
128137
connection.init_database(test_db_path, create_tables=True)
129138

130139
client.application.config["DATA_FOLDER_PATH"] = original_data_folder
131140

141+
132142
def test_save_viewable_workflow_from_file(client):
133143
route = "/opengeodeweb_back/save_viewable_file"
134144
payload = {"input_geode_object": "BRep", "filename": "cube.og_brep"}

0 commit comments

Comments
 (0)