Skip to content

Commit b2cf2e8

Browse files
committed
test
1 parent ef772ee commit b2cf2e8

2 files changed

Lines changed: 47 additions & 2 deletions

File tree

src/opengeodeweb_back/routes/blueprint_routes.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,6 @@ def export_project() -> flask.Response:
285285
project_folder: str = flask.current_app.config["DATA_FOLDER_PATH"]
286286
os.makedirs(project_folder, exist_ok=True)
287287

288-
if not params.filename:
289-
flask.abort(400, "filename is required")
290288
filename: str = werkzeug.utils.secure_filename(os.path.basename(params.filename))
291289
export_zip_path = os.path.join(project_folder, filename)
292290

tests/test_models_routes.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,50 @@ def test_import_project_route(client, tmp_path):
121121
assert os.path.exists(pre_existing_db_path)
122122
with open(pre_existing_db_path, "rb") as file:
123123
assert file.read() == new_database_bytes
124+
125+
126+
def test_save_viewable_workflow_from_file(client):
127+
route = "/opengeodeweb_back/save_viewable_file"
128+
payload = {"input_geode_object": "BRep", "filename": "cube.og_brep"}
129+
130+
response = client.post(route, json=payload)
131+
assert response.status_code == 200
132+
133+
data_id = response.json["id"]
134+
assert isinstance(data_id, str) and len(data_id) > 0
135+
assert response.json["viewable_file_name"].endswith(".vtm")
136+
137+
comp_resp = client.post(
138+
"/opengeodeweb_back/models/vtm_component_indices", json={"id": data_id}
139+
)
140+
assert comp_resp.status_code == 200
141+
142+
refreshed = Data.get(data_id)
143+
assert refreshed is not None
144+
145+
146+
def test_save_viewable_workflow_from_object(client):
147+
# Chemin “from object” : passe par un endpoint de création qui génère/sauvegarde via save_viewable.
148+
route = "/opengeodeweb_back/create/create_aoi"
149+
aoi_data = {
150+
"name": "workflow_aoi",
151+
"points": [
152+
{"x": 0.0, "y": 0.0},
153+
{"x": 1.0, "y": 0.0},
154+
{"x": 1.0, "y": 1.0},
155+
{"x": 0.0, "y": 1.0},
156+
],
157+
"z": 0.0,
158+
}
159+
160+
response = client.post(route, json=aoi_data)
161+
assert response.status_code == 200
162+
163+
data_id = response.json["id"]
164+
assert isinstance(data_id, str) and len(data_id) > 0
165+
assert response.json["geode_object"] == "EdgedCurve3D"
166+
assert response.json["viewable_file_name"].endswith(".vtp")
167+
168+
attr_resp = client.post("/opengeodeweb_back/vertex_attribute_names", json={"id": data_id})
169+
assert attr_resp.status_code == 200
170+
assert isinstance(attr_resp.json.get("vertex_attribute_names", []), list)

0 commit comments

Comments
 (0)