Skip to content

Commit 86c0dcc

Browse files
MaxNumeriquegithub-actions[bot]
authored andcommitted
Apply prepare changes
1 parent 875590c commit 86c0dcc

File tree

8 files changed

+49
-12
lines changed

8 files changed

+49
-12
lines changed

opengeodeweb_back_schemas.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,17 @@
296296
],
297297
"additionalProperties": false
298298
},
299+
"import_project": {
300+
"$id": "opengeodeweb_back/import_project",
301+
"route": "/import_project",
302+
"methods": [
303+
"POST"
304+
],
305+
"type": "object",
306+
"properties": {},
307+
"required": [],
308+
"additionalProperties": false
309+
},
299310
"geographic_coordinate_systems": {
300311
"$id": "opengeodeweb_back/geographic_coordinate_systems",
301312
"route": "/geographic_coordinate_systems",
@@ -337,6 +348,27 @@
337348
],
338349
"additionalProperties": false
339350
},
351+
"export_project": {
352+
"$id": "opengeodeweb_back/export_project",
353+
"route": "/export_project",
354+
"methods": [
355+
"POST"
356+
],
357+
"type": "object",
358+
"properties": {
359+
"snapshot": {
360+
"type": "object"
361+
},
362+
"filename": {
363+
"type": "string",
364+
"minLength": 1
365+
}
366+
},
367+
"required": [
368+
"snapshot"
369+
],
370+
"additionalProperties": false
371+
},
340372
"allowed_objects": {
341373
"$id": "opengeodeweb_back/allowed_objects",
342374
"route": "/allowed_objects",

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,3 @@ werkzeug==3.1.2
6060
# flask
6161
# flask-cors
6262

63-
opengeodeweb-microservice==1.*,>=1.0.6rc1

src/opengeodeweb_back/routes/blueprint_routes.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,7 @@ def import_project() -> flask.Response:
331331
with zipfile.ZipFile(zip_file.stream) as zf:
332332
base = os.path.abspath(data_folder_path)
333333
for member in zf.namelist():
334-
target = os.path.abspath(
335-
os.path.normpath(os.path.join(base, member))
336-
)
334+
target = os.path.abspath(os.path.normpath(os.path.join(base, member)))
337335
if not (target == base or target.startswith(base + os.sep)):
338336
flask.abort(400, "Zip contains unsafe paths")
339337
zf.extractall(data_folder_path)

src/opengeodeweb_back/routes/schemas/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
from .missing_files import *
99
from .kill import *
1010
from .inspect_file import *
11+
from .import_project import *
1112
from .geographic_coordinate_systems import *
1213
from .geode_objects_and_output_extensions import *
14+
from .export_project import *
1315
from .allowed_objects import *
1416
from .allowed_files import *
15-
from .export_project import *
16-
from .import_project import *

src/opengeodeweb_back/routes/schemas/export_project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
@dataclass
77
class ExportProject(DataClassJsonMixin):
88
snapshot: Dict[str, Any]
9-
filename: Optional[str] = None
9+
filename: Optional[str] = None

src/opengeodeweb_back/routes/schemas/import_project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
@dataclass
66
class ImportProject(DataClassJsonMixin):
7-
pass
7+
pass

tests/test_models_routes.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ def test_extract_brep_uuids(client, test_id):
6262

6363
def test_export_project_route(client, tmp_path):
6464
route = "/opengeodeweb_back/export_project"
65-
snapshot = {"styles": {"1": {"visibility": True, "opacity": 1.0, "color": [0.2, 0.6, 0.9]}}}
65+
snapshot = {
66+
"styles": {"1": {"visibility": True, "opacity": 1.0, "color": [0.2, 0.6, 0.9]}}
67+
}
6668
filename = "export_project_test.zip"
6769
response = client.post(route, json={"snapshot": snapshot, "filename": filename})
6870
assert response.status_code == 200
@@ -87,7 +89,9 @@ def test_export_project_route(client, tmp_path):
8789

8890
def test_import_project_route(client, tmp_path):
8991
route = "/opengeodeweb_back/import_project"
90-
snapshot = {"styles": {"1": {"visibility": True, "opacity": 1.0, "color": [0.2, 0.6, 0.9]}}}
92+
snapshot = {
93+
"styles": {"1": {"visibility": True, "opacity": 1.0, "color": [0.2, 0.6, 0.9]}}
94+
}
9195

9296
data_folder = client.application.config["DATA_FOLDER_PATH"]
9397
pre_existing_db_path = os.path.join(data_folder, "1", "project.db")

tests/test_utils_functions.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ def test_send_file_multiple_returns_zip(client, tmp_path):
221221
file_path.write_bytes(content)
222222
file_paths.append(str(file_path))
223223
with app.test_request_context():
224-
response = utils_functions.send_file(app.config["UPLOAD_FOLDER"], file_paths, "bundle")
224+
response = utils_functions.send_file(
225+
app.config["UPLOAD_FOLDER"], file_paths, "bundle"
226+
)
225227
assert response.status_code == 200
226228
assert response.mimetype == "application/zip"
227229
assert response.headers.get("new-file-name") == "bundle.zip"
@@ -242,7 +244,9 @@ def test_send_file_single_returns_octet_binary(client, tmp_path):
242244
file_path = tmp_path / "tmp_send_file_1.txt"
243245
file_path.write_bytes(b"hello 1")
244246
with app.test_request_context():
245-
response = utils_functions.send_file(app.config["UPLOAD_FOLDER"], [str(file_path)], "tmp_send_file_1.txt")
247+
response = utils_functions.send_file(
248+
app.config["UPLOAD_FOLDER"], [str(file_path)], "tmp_send_file_1.txt"
249+
)
246250
assert response.status_code == 200
247251
assert response.mimetype == "application/octet-binary"
248252
assert response.headers.get("new-file-name") == "tmp_send_file_1.txt"

0 commit comments

Comments
 (0)