Skip to content

Commit c9ba3e7

Browse files
fix tests
1 parent d068a01 commit c9ba3e7

5 files changed

Lines changed: 18 additions & 107 deletions

File tree

opengeodeweb_back_schemas.json

Lines changed: 3 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,9 @@
11
{
22
"opengeodeweb_back": {
33
"create": {
4-
"create_voi": {
5-
"$id": "opengeodeweb_back/create/create_voi",
6-
"route": "/create_voi",
7-
"methods": [
8-
"POST"
9-
],
10-
"type": "object",
11-
"properties": {
12-
"name": {
13-
"type": "string",
14-
"description": "Name of the VOI"
15-
},
16-
"aoi_id": {
17-
"type": "string",
18-
"description": "ID of the corresponding AOI"
19-
},
20-
"z_min": {
21-
"type": "number",
22-
"description": "Minimum Z coordinate"
23-
},
24-
"z_max": {
25-
"type": "number",
26-
"description": "Maximum Z coordinate"
27-
},
28-
"id": {
29-
"type": "string",
30-
"description": "Optional ID for updating existing VOI"
31-
}
32-
},
33-
"required": [
34-
"name",
35-
"aoi_id",
36-
"z_min",
37-
"z_max"
38-
],
39-
"additionalProperties": false
40-
},
41-
"create_point": {
42-
"$id": "opengeodeweb_back/create/create_point",
43-
"route": "/create_point",
4+
"point": {
5+
"$id": "opengeodeweb_back/create/point",
6+
"route": "/point",
447
"methods": [
458
"POST"
469
],
@@ -67,52 +30,6 @@
6730
"z"
6831
],
6932
"additionalProperties": false
70-
},
71-
"create_aoi": {
72-
"$id": "opengeodeweb_back/create/create_aoi",
73-
"route": "/create_aoi",
74-
"methods": [
75-
"POST"
76-
],
77-
"type": "object",
78-
"properties": {
79-
"name": {
80-
"type": "string",
81-
"description": "Name of the AOI"
82-
},
83-
"points": {
84-
"type": "array",
85-
"items": {
86-
"type": "object",
87-
"properties": {
88-
"x": {
89-
"type": "number"
90-
},
91-
"y": {
92-
"type": "number"
93-
}
94-
},
95-
"required": [
96-
"x",
97-
"y"
98-
],
99-
"additionalProperties": false
100-
},
101-
"minItems": 3
102-
},
103-
"z": {
104-
"type": "number"
105-
},
106-
"id": {
107-
"type": "string"
108-
}
109-
},
110-
"required": [
111-
"name",
112-
"points",
113-
"z"
114-
],
115-
"additionalProperties": false
11633
}
11734
},
11835
"models": {

src/opengeodeweb_back/routes/create/blueprint_create.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# Local application imports
1010
from opengeodeweb_back import geode_functions, utils_functions
11-
from opengeodeweb_back.routes.create.schemas import schemas
11+
import opengeodeweb_back.routes.create.schemas as schemas
1212
from opengeodeweb_back.geode_objects.geode_point_set3d import GeodePointSet3D
1313
from opengeodeweb_back.geode_objects.geode_edged_curve3d import GeodeEdgedCurve3D
1414

@@ -23,7 +23,7 @@
2323
def point() -> flask.Response:
2424
"""Endpoint to create a single point in 3D space."""
2525
json_data = utils_functions.validate_request(
26-
flask.request, schemas_dict["create_point"]
26+
flask.request, schemas_dict["point"]
2727
)
2828
params = schemas.Point.from_dict(json_data)
2929

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1+
from .point import *

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ def configure_test_environment() -> Generator[None, None, None]:
4141

4242
init_database(db_path)
4343
os.environ["TEST_DB_PATH"] = str(db_path)
44-
44+
register_ogw_back_blueprints(app)
4545
yield
4646

4747
tmp_data_path = app.config.get("DATA_FOLDER_PATH")
4848
if tmp_data_path and os.path.exists(tmp_data_path):
4949
shutil.rmtree(tmp_data_path, ignore_errors=True)
5050
print(f"Cleaned up test data folder: {tmp_data_path}", flush=True)
51-
register_ogw_back_blueprints(app)
51+
5252

5353

5454
@pytest.fixture

tests/test_models_routes.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -206,24 +206,20 @@ def test_save_viewable_workflow_from_file(client: FlaskClient) -> None:
206206

207207

208208
def test_save_viewable_workflow_from_object(client: FlaskClient) -> None:
209-
route = "/opengeodeweb_back/create/create_aoi"
210-
aoi_data = {
211-
"name": "workflow_aoi",
212-
"points": [
213-
{"x": 0.0, "y": 0.0},
214-
{"x": 1.0, "y": 0.0},
215-
{"x": 1.0, "y": 1.0},
216-
{"x": 0.0, "y": 1.0},
217-
],
209+
route = "/opengeodeweb_back/create/point"
210+
point_data = {
211+
"name": "workflow_point_3d",
212+
"x": 0.0,
213+
"y": 0.0,
218214
"z": 0.0,
219215
}
220216

221-
response = client.post(route, json=aoi_data)
217+
response = client.post(route, json=point_data)
222218
assert response.status_code == 200
223219

224220
data_id = response.get_json()["id"]
225221
assert isinstance(data_id, str) and len(data_id) > 0
226-
assert response.get_json()["geode_object_type"] == "EdgedCurve3D"
222+
assert response.get_json()["geode_object_type"] == "PointSet3D"
227223
assert response.get_json()["viewable_file"].endswith(".vtp")
228224

229225

@@ -239,11 +235,11 @@ def test_import_extension_route(client: FlaskClient, tmp_path: Path) -> None:
239235
vext_path = tmp_path / "test-extension-1.0.0.vext"
240236
with zipfile.ZipFile(vext_path, "w", compression=zipfile.ZIP_DEFLATED) as zipf:
241237
zipf.writestr(
242-
"dist/test-extension-extension.es.js",
238+
"test-extension-extension.es.js",
243239
"export const metadata = { id: 'test-extension', name: 'Test Extension' };",
244240
)
245-
zipf.writestr("dist/test-extension-back", "#!/bin/bash\necho 'mock backend'")
246-
zipf.writestr("dist/test-extension.css", ".test { color: red; }")
241+
zipf.writestr("test-extension-back", "#!/bin/bash\necho 'mock backend'")
242+
zipf.writestr("test-extension.css", ".test { color: red; }")
247243
with open(vext_path, "rb") as f:
248244
response = client.post(
249245
route,
@@ -261,8 +257,6 @@ def test_import_extension_route(client: FlaskClient, tmp_path: Path) -> None:
261257
)
262258
extension_path = os.path.join(extensions_folder, "test-extension")
263259
assert os.path.exists(extension_path)
264-
dist_path = os.path.join(extension_path, "dist")
265-
assert os.path.exists(dist_path)
266260

267261
# Verify frontend content is returned
268262
frontend_content = json_data["frontend_content"]

0 commit comments

Comments
 (0)