OpenGeodeWeb-Back 5.4.0rc1__tar.gz → 5.4.0rc2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. {opengeodeweb_back-5.4.0rc1/src/OpenGeodeWeb_Back.egg-info → opengeodeweb_back-5.4.0rc2}/PKG-INFO +17 -17
  2. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/pyproject.toml +1 -1
  3. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/requirements.txt +16 -16
  4. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2/src/OpenGeodeWeb_Back.egg-info}/PKG-INFO +17 -17
  5. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/src/OpenGeodeWeb_Back.egg-info/SOURCES.txt +3 -0
  6. opengeodeweb_back-5.4.0rc2/src/OpenGeodeWeb_Back.egg-info/requires.txt +28 -0
  7. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/src/opengeodeweb_back/geode_objects.py +5 -0
  8. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/src/opengeodeweb_back/routes/blueprint_routes.py +62 -0
  9. opengeodeweb_back-5.4.0rc2/src/opengeodeweb_back/routes/schemas/polygon_attribute_names.json +15 -0
  10. opengeodeweb_back-5.4.0rc2/src/opengeodeweb_back/routes/schemas/vertex_attribute_names.json +15 -0
  11. opengeodeweb_back-5.4.0rc2/src/opengeodeweb_back/test_utils.py +25 -0
  12. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/tests/test_geode_functions.py +5 -0
  13. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/tests/test_routes.py +84 -61
  14. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/tests/test_utils_functions.py +5 -0
  15. opengeodeweb_back-5.4.0rc1/src/OpenGeodeWeb_Back.egg-info/requires.txt +0 -28
  16. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/LICENSE +0 -0
  17. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/README.md +0 -0
  18. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/setup.cfg +0 -0
  19. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/src/OpenGeodeWeb_Back.egg-info/dependency_links.txt +0 -0
  20. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/src/OpenGeodeWeb_Back.egg-info/top_level.txt +0 -0
  21. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/src/opengeodeweb_back/__init__.py +0 -0
  22. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/src/opengeodeweb_back/app_config.py +0 -0
  23. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/src/opengeodeweb_back/geode_functions.py +0 -0
  24. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/src/opengeodeweb_back/routes/schemas/allowed_files.json +0 -0
  25. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/src/opengeodeweb_back/routes/schemas/allowed_objects.json +0 -0
  26. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/src/opengeodeweb_back/routes/schemas/create_point.json +0 -0
  27. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/src/opengeodeweb_back/routes/schemas/geode_objects_and_output_extensions.json +0 -0
  28. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/src/opengeodeweb_back/routes/schemas/geographic_coordinate_systems.json +0 -0
  29. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/src/opengeodeweb_back/routes/schemas/inspect_file.json +0 -0
  30. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/src/opengeodeweb_back/routes/schemas/missing_files.json +0 -0
  31. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/src/opengeodeweb_back/routes/schemas/ping.json +0 -0
  32. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/src/opengeodeweb_back/routes/schemas/save_viewable_file.json +0 -0
  33. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/src/opengeodeweb_back/routes/schemas/upload_file.json +0 -0
  34. {opengeodeweb_back-5.4.0rc1 → opengeodeweb_back-5.4.0rc2}/src/opengeodeweb_back/utils_functions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: OpenGeodeWeb-Back
3
- Version: 5.4.0rc1
3
+ Version: 5.4.0rc2
4
4
  Summary: OpenGeodeWeb-Back is an open source framework that proposes handy python functions and wrappers for the OpenGeode ecosystem
5
5
  Author-email: Geode-solutions <team-web@geode-solutions.com>
6
6
  Project-URL: Homepage, https://github.com/Geode-solutions/OpenGeodeWeb-Back
@@ -13,32 +13,32 @@ Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
14
  Requires-Dist: asgiref==3.8.1
15
15
  Requires-Dist: attrs==24.2.0
16
- Requires-Dist: blinker==1.8.2
16
+ Requires-Dist: blinker==1.9.0
17
17
  Requires-Dist: click==8.1.7
18
- Requires-Dist: flask[async]==3.0.3
18
+ Requires-Dist: flask[async]==3.1.0
19
19
  Requires-Dist: flask-cors==5.0.0
20
- Requires-Dist: geode-background==8.7.0
21
- Requires-Dist: geode-common==33.0.9
22
- Requires-Dist: geode-conversion==6.0.14
23
- Requires-Dist: geode-explicit==6.1.14
24
- Requires-Dist: geode-implicit==3.3.2
25
- Requires-Dist: geode-numerics==5.1.8
26
- Requires-Dist: geode-simplex==8.2.15
27
- Requires-Dist: geode-viewables==3.0.6
20
+ Requires-Dist: geode-background==8.7.5
21
+ Requires-Dist: geode-common==33.1.3
22
+ Requires-Dist: geode-conversion==6.0.18
23
+ Requires-Dist: geode-explicit==6.1.17
24
+ Requires-Dist: geode-implicit==3.3.5
25
+ Requires-Dist: geode-numerics==5.2.0
26
+ Requires-Dist: geode-simplex==8.2.18
27
+ Requires-Dist: geode-viewables==3.0.8
28
28
  Requires-Dist: itsdangerous==2.2.0
29
29
  Requires-Dist: jinja2==3.1.4
30
30
  Requires-Dist: jsonschema==4.23.0
31
31
  Requires-Dist: jsonschema-specifications==2024.10.1
32
32
  Requires-Dist: markupsafe==3.0.2
33
- Requires-Dist: opengeode-core==15.6.3
34
- Requires-Dist: opengeode-geosciences==8.1.1
35
- Requires-Dist: opengeode-geosciencesio==5.2.3
36
- Requires-Dist: opengeode-inspector==6.1.12
37
- Requires-Dist: opengeode-io==7.0.5
33
+ Requires-Dist: opengeode-core==15.6.7
34
+ Requires-Dist: opengeode-geosciences==8.2.0
35
+ Requires-Dist: opengeode-geosciencesio==5.3.2
36
+ Requires-Dist: opengeode-inspector==6.1.15
37
+ Requires-Dist: opengeode-io==7.0.7
38
38
  Requires-Dist: referencing==0.35.1
39
39
  Requires-Dist: rpds-py==0.21.0
40
40
  Requires-Dist: typing-extensions==4.12.2
41
- Requires-Dist: werkzeug==3.1.2
41
+ Requires-Dist: werkzeug==3.1.3
42
42
 
43
43
  <h1 align="center">OpenGeodeWeb-Back<sup><i>by Geode-solutions</i></sup></h1>
44
44
  <h3 align="center">OpenSource Python framework based on OpenGeode</h3>
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
 
6
6
  [project]
7
7
  name = "OpenGeodeWeb-Back"
8
- version = "5.4.0-rc.1"
8
+ version = "5.4.0-rc.2"
9
9
  dynamic = ["dependencies"]
10
10
  authors = [
11
11
  { name="Geode-solutions", email="team-web@geode-solutions.com" },
@@ -10,22 +10,22 @@ attrs==24.2.0
10
10
  # via
11
11
  # jsonschema
12
12
  # referencing
13
- blinker==1.8.2
13
+ blinker==1.9.0
14
14
  # via flask
15
15
  click==8.1.7
16
16
  # via flask
17
- flask[async]==3.0.3
17
+ flask[async]==3.1.0
18
18
  # via
19
19
  # -r requirements.in
20
20
  # flask-cors
21
21
  flask-cors==5.0.0
22
22
  # via -r requirements.in
23
- geode-background==8.7.0
23
+ geode-background==8.7.5
24
24
  # via
25
25
  # geode-explicit
26
26
  # geode-implicit
27
27
  # geode-simplex
28
- geode-common==33.0.9
28
+ geode-common==33.1.3
29
29
  # via
30
30
  # -r requirements.in
31
31
  # geode-background
@@ -35,26 +35,26 @@ geode-common==33.0.9
35
35
  # geode-numerics
36
36
  # geode-simplex
37
37
  # geode-viewables
38
- geode-conversion==6.0.14
38
+ geode-conversion==6.0.18
39
39
  # via
40
40
  # geode-explicit
41
41
  # geode-implicit
42
- geode-explicit==6.1.14
42
+ geode-explicit==6.1.17
43
43
  # via
44
44
  # -r requirements.in
45
45
  # geode-implicit
46
- geode-implicit==3.3.2
46
+ geode-implicit==3.3.5
47
47
  # via -r requirements.in
48
- geode-numerics==5.1.8
48
+ geode-numerics==5.2.0
49
49
  # via
50
50
  # -r requirements.in
51
51
  # geode-implicit
52
52
  # geode-simplex
53
- geode-simplex==8.2.15
53
+ geode-simplex==8.2.18
54
54
  # via
55
55
  # -r requirements.in
56
56
  # geode-implicit
57
- geode-viewables==3.0.6
57
+ geode-viewables==3.0.8
58
58
  # via -r requirements.in
59
59
  itsdangerous==2.2.0
60
60
  # via flask
@@ -68,7 +68,7 @@ markupsafe==3.0.2
68
68
  # via
69
69
  # jinja2
70
70
  # werkzeug
71
- opengeode-core==15.6.3
71
+ opengeode-core==15.6.7
72
72
  # via
73
73
  # -r requirements.in
74
74
  # geode-background
@@ -83,23 +83,23 @@ opengeode-core==15.6.3
83
83
  # opengeode-geosciencesio
84
84
  # opengeode-inspector
85
85
  # opengeode-io
86
- opengeode-geosciences==8.1.1
86
+ opengeode-geosciences==8.2.0
87
87
  # via
88
88
  # -r requirements.in
89
89
  # geode-implicit
90
90
  # geode-viewables
91
91
  # opengeode-geosciencesio
92
- opengeode-geosciencesio==5.2.3
92
+ opengeode-geosciencesio==5.3.2
93
93
  # via
94
94
  # -r requirements.in
95
95
  # geode-implicit
96
- opengeode-inspector==6.1.12
96
+ opengeode-inspector==6.1.15
97
97
  # via
98
98
  # -r requirements.in
99
99
  # geode-explicit
100
100
  # geode-implicit
101
101
  # geode-simplex
102
- opengeode-io==7.0.5
102
+ opengeode-io==7.0.7
103
103
  # via
104
104
  # -r requirements.in
105
105
  # geode-implicit
@@ -115,7 +115,7 @@ rpds-py==0.21.0
115
115
  # referencing
116
116
  typing-extensions==4.12.2
117
117
  # via asgiref
118
- werkzeug==3.1.2
118
+ werkzeug==3.1.3
119
119
  # via
120
120
  # -r requirements.in
121
121
  # flask
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: OpenGeodeWeb-Back
3
- Version: 5.4.0rc1
3
+ Version: 5.4.0rc2
4
4
  Summary: OpenGeodeWeb-Back is an open source framework that proposes handy python functions and wrappers for the OpenGeode ecosystem
5
5
  Author-email: Geode-solutions <team-web@geode-solutions.com>
6
6
  Project-URL: Homepage, https://github.com/Geode-solutions/OpenGeodeWeb-Back
@@ -13,32 +13,32 @@ Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
14
  Requires-Dist: asgiref==3.8.1
15
15
  Requires-Dist: attrs==24.2.0
16
- Requires-Dist: blinker==1.8.2
16
+ Requires-Dist: blinker==1.9.0
17
17
  Requires-Dist: click==8.1.7
18
- Requires-Dist: flask[async]==3.0.3
18
+ Requires-Dist: flask[async]==3.1.0
19
19
  Requires-Dist: flask-cors==5.0.0
20
- Requires-Dist: geode-background==8.7.0
21
- Requires-Dist: geode-common==33.0.9
22
- Requires-Dist: geode-conversion==6.0.14
23
- Requires-Dist: geode-explicit==6.1.14
24
- Requires-Dist: geode-implicit==3.3.2
25
- Requires-Dist: geode-numerics==5.1.8
26
- Requires-Dist: geode-simplex==8.2.15
27
- Requires-Dist: geode-viewables==3.0.6
20
+ Requires-Dist: geode-background==8.7.5
21
+ Requires-Dist: geode-common==33.1.3
22
+ Requires-Dist: geode-conversion==6.0.18
23
+ Requires-Dist: geode-explicit==6.1.17
24
+ Requires-Dist: geode-implicit==3.3.5
25
+ Requires-Dist: geode-numerics==5.2.0
26
+ Requires-Dist: geode-simplex==8.2.18
27
+ Requires-Dist: geode-viewables==3.0.8
28
28
  Requires-Dist: itsdangerous==2.2.0
29
29
  Requires-Dist: jinja2==3.1.4
30
30
  Requires-Dist: jsonschema==4.23.0
31
31
  Requires-Dist: jsonschema-specifications==2024.10.1
32
32
  Requires-Dist: markupsafe==3.0.2
33
- Requires-Dist: opengeode-core==15.6.3
34
- Requires-Dist: opengeode-geosciences==8.1.1
35
- Requires-Dist: opengeode-geosciencesio==5.2.3
36
- Requires-Dist: opengeode-inspector==6.1.12
37
- Requires-Dist: opengeode-io==7.0.5
33
+ Requires-Dist: opengeode-core==15.6.7
34
+ Requires-Dist: opengeode-geosciences==8.2.0
35
+ Requires-Dist: opengeode-geosciencesio==5.3.2
36
+ Requires-Dist: opengeode-inspector==6.1.15
37
+ Requires-Dist: opengeode-io==7.0.7
38
38
  Requires-Dist: referencing==0.35.1
39
39
  Requires-Dist: rpds-py==0.21.0
40
40
  Requires-Dist: typing-extensions==4.12.2
41
- Requires-Dist: werkzeug==3.1.2
41
+ Requires-Dist: werkzeug==3.1.3
42
42
 
43
43
  <h1 align="center">OpenGeodeWeb-Back<sup><i>by Geode-solutions</i></sup></h1>
44
44
  <h3 align="center">OpenSource Python framework based on OpenGeode</h3>
@@ -11,6 +11,7 @@ src/opengeodeweb_back/__init__.py
11
11
  src/opengeodeweb_back/app_config.py
12
12
  src/opengeodeweb_back/geode_functions.py
13
13
  src/opengeodeweb_back/geode_objects.py
14
+ src/opengeodeweb_back/test_utils.py
14
15
  src/opengeodeweb_back/utils_functions.py
15
16
  src/opengeodeweb_back/routes/blueprint_routes.py
16
17
  src/opengeodeweb_back/routes/schemas/allowed_files.json
@@ -21,8 +22,10 @@ src/opengeodeweb_back/routes/schemas/geographic_coordinate_systems.json
21
22
  src/opengeodeweb_back/routes/schemas/inspect_file.json
22
23
  src/opengeodeweb_back/routes/schemas/missing_files.json
23
24
  src/opengeodeweb_back/routes/schemas/ping.json
25
+ src/opengeodeweb_back/routes/schemas/polygon_attribute_names.json
24
26
  src/opengeodeweb_back/routes/schemas/save_viewable_file.json
25
27
  src/opengeodeweb_back/routes/schemas/upload_file.json
28
+ src/opengeodeweb_back/routes/schemas/vertex_attribute_names.json
26
29
  tests/test_geode_functions.py
27
30
  tests/test_routes.py
28
31
  tests/test_utils_functions.py
@@ -0,0 +1,28 @@
1
+ asgiref==3.8.1
2
+ attrs==24.2.0
3
+ blinker==1.9.0
4
+ click==8.1.7
5
+ flask[async]==3.1.0
6
+ flask-cors==5.0.0
7
+ geode-background==8.7.5
8
+ geode-common==33.1.3
9
+ geode-conversion==6.0.18
10
+ geode-explicit==6.1.17
11
+ geode-implicit==3.3.5
12
+ geode-numerics==5.2.0
13
+ geode-simplex==8.2.18
14
+ geode-viewables==3.0.8
15
+ itsdangerous==2.2.0
16
+ jinja2==3.1.4
17
+ jsonschema==4.23.0
18
+ jsonschema-specifications==2024.10.1
19
+ markupsafe==3.0.2
20
+ opengeode-core==15.6.7
21
+ opengeode-geosciences==8.2.0
22
+ opengeode-geosciencesio==5.3.2
23
+ opengeode-inspector==6.1.15
24
+ opengeode-io==7.0.7
25
+ referencing==0.35.1
26
+ rpds-py==0.21.0
27
+ typing-extensions==4.12.2
28
+ werkzeug==3.1.3
@@ -1,3 +1,6 @@
1
+ # Standard library imports
2
+
3
+ # Third party imports
1
4
  import opengeode as og
2
5
  import opengeode_io as og_io
3
6
  import opengeode_inspector as og_inspector
@@ -5,6 +8,8 @@ import opengeode_geosciences as og_gs
5
8
  import opengeode_geosciencesio as og_gs_io
6
9
  import geode_viewables as g_v
7
10
 
11
+ # Local application imports
12
+
8
13
 
9
14
  def geode_objects_dict():
10
15
  return {
@@ -304,6 +304,68 @@ def create_point():
304
304
  )
305
305
 
306
306
 
307
+ with open(
308
+ os.path.join(schemas, "vertex_attribute_names.json"),
309
+ "r",
310
+ ) as file:
311
+ vertex_attribute_names_json = json.load(file)
312
+
313
+
314
+ @routes.route(
315
+ vertex_attribute_names_json["route"],
316
+ methods=vertex_attribute_names_json["methods"],
317
+ )
318
+ def vertex_attribute_names():
319
+
320
+ UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"]
321
+ utils_functions.validate_request(flask.request, vertex_attribute_names_json)
322
+ file_absolute_path = os.path.join(
323
+ UPLOAD_FOLDER, werkzeug.utils.secure_filename(flask.request.json["filename"])
324
+ )
325
+ data = geode_functions.load(
326
+ flask.request.json["input_geode_object"], file_absolute_path
327
+ )
328
+ vertex_attribute_names = data.vertex_attribute_manager().attribute_names()
329
+
330
+ return flask.make_response(
331
+ {
332
+ "vertex_attribute_names": vertex_attribute_names,
333
+ },
334
+ 200,
335
+ )
336
+
337
+
338
+ with open(
339
+ os.path.join(schemas, "polygon_attribute_names.json"),
340
+ "r",
341
+ ) as file:
342
+ polygon_attribute_names_json = json.load(file)
343
+
344
+
345
+ @routes.route(
346
+ polygon_attribute_names_json["route"],
347
+ methods=polygon_attribute_names_json["methods"],
348
+ )
349
+ def polygon_attribute_names():
350
+
351
+ UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"]
352
+ utils_functions.validate_request(flask.request, vertex_attribute_names_json)
353
+ file_absolute_path = os.path.join(
354
+ UPLOAD_FOLDER, werkzeug.utils.secure_filename(flask.request.json["filename"])
355
+ )
356
+ data = geode_functions.load(
357
+ flask.request.json["input_geode_object"], file_absolute_path
358
+ )
359
+ polygon_attribute_names = data.polygon_attribute_manager().attribute_names()
360
+
361
+ return flask.make_response(
362
+ {
363
+ "polygon_attribute_names": polygon_attribute_names,
364
+ },
365
+ 200,
366
+ )
367
+
368
+
307
369
  with open(
308
370
  os.path.join(schemas, "ping.json"),
309
371
  "r",
@@ -0,0 +1,15 @@
1
+ {
2
+ "route": "/polygon_attribute_names",
3
+ "methods": ["POST"],
4
+ "type": "object",
5
+ "properties": {
6
+ "input_geode_object": {
7
+ "type": "string"
8
+ },
9
+ "filename": {
10
+ "type": "string"
11
+ }
12
+ },
13
+ "required": ["input_geode_object", "filename"],
14
+ "additionalProperties": false
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "route": "/vertex_attribute_names",
3
+ "methods": ["POST"],
4
+ "type": "object",
5
+ "properties": {
6
+ "input_geode_object": {
7
+ "type": "string"
8
+ },
9
+ "filename": {
10
+ "type": "string"
11
+ }
12
+ },
13
+ "required": ["input_geode_object", "filename"],
14
+ "additionalProperties": false
15
+ }
@@ -0,0 +1,25 @@
1
+ # Standard library imports
2
+
3
+ # Third party imports
4
+
5
+ # Local application imports
6
+
7
+
8
+ def test_route_wrong_params(client, route, get_full_data):
9
+ for key, value in get_full_data().items():
10
+ json = get_full_data()
11
+ json.pop(key)
12
+ response = client.post(route, json=json)
13
+ assert response.status_code == 400
14
+ error_description = response.json["description"]
15
+ assert error_description == f"Validation error: '{key}' is a required property"
16
+
17
+ json = get_full_data()
18
+ json["dumb_key"] = "dumb_value"
19
+ response = client.post(route, json=json)
20
+ assert response.status_code == 400
21
+ error_description = response.json["description"]
22
+ assert (
23
+ error_description
24
+ == "Validation error: Additional properties are not allowed ('dumb_key' was unexpected)"
25
+ )
@@ -1,5 +1,10 @@
1
+ # Standard library imports
1
2
  import os
2
3
  import uuid
4
+
5
+ # Third party imports
6
+
7
+ # Local application imports
3
8
  from src.opengeodeweb_back import geode_functions, geode_objects
4
9
 
5
10
 
@@ -1,17 +1,28 @@
1
- import os
1
+ # Standard library imports
2
2
  import base64
3
+ import os
4
+
5
+ # Third party imports
3
6
  from werkzeug.datastructures import FileStorage
4
7
 
8
+ # Local application imports
9
+ from src.opengeodeweb_back import test_utils
10
+
5
11
 
6
12
  def test_allowed_files(client):
7
13
  route = f"/allowed_files"
8
- response = client.post(route, json={"supported_feature": None})
14
+ get_full_data = lambda: {"supported_feature": "None"}
15
+ json = get_full_data()
16
+ response = client.post(route, json=json)
9
17
  assert response.status_code == 200
10
18
  extensions = response.json["extensions"]
11
19
  assert type(extensions) is list
12
20
  for extension in extensions:
13
21
  assert type(extension) is str
14
22
 
23
+ # Test all params
24
+ test_utils.test_route_wrong_params(client, route, get_full_data)
25
+
15
26
 
16
27
  def test_allowed_objects(client):
17
28
  route = f"/allowed_objects"
@@ -30,13 +41,8 @@ def test_allowed_objects(client):
30
41
  for allowed_object in allowed_objects:
31
42
  assert type(allowed_object) is str
32
43
 
33
- for key, value in get_full_data().items():
34
- json = get_full_data()
35
- json.pop(key)
36
- response = client.post(route, json=json)
37
- assert response.status_code == 400
38
- error_description = response.json["description"]
39
- assert error_description == f"Validation error: '{key}' is a required property"
44
+ # Test all params
45
+ test_utils.test_route_wrong_params(client, route, get_full_data)
40
46
 
41
47
 
42
48
  def test_upload_file(client):
@@ -58,11 +64,7 @@ def test_missing_files(client):
58
64
  }
59
65
 
60
66
  json = get_full_data()
61
- response = client.post(
62
- route,
63
- json=json,
64
- )
65
-
67
+ response = client.post(route, json=json)
66
68
  assert response.status_code == 200
67
69
  has_missing_files = response.json["has_missing_files"]
68
70
  mandatory_files = response.json["mandatory_files"]
@@ -71,33 +73,23 @@ def test_missing_files(client):
71
73
  assert type(mandatory_files) is list
72
74
  assert type(additional_files) is list
73
75
 
74
- for key, value in get_full_data().items():
75
- json = get_full_data()
76
- json.pop(key)
77
- response = client.post(route, json=json)
78
- assert response.status_code == 400
79
- error_description = response.json["description"]
80
- assert error_description == f"Validation error: '{key}' is a required property"
76
+ # Test all params
77
+ test_utils.test_route_wrong_params(client, route, get_full_data)
81
78
 
82
79
 
83
80
  def test_geographic_coordinate_systems(client):
84
81
  route = f"/geographic_coordinate_systems"
85
-
82
+ get_full_data = lambda: {"input_geode_object": "BRep"}
86
83
  # Normal test with geode_object 'BRep'
87
- response = client.post(route, json={"input_geode_object": "BRep"})
84
+ response = client.post(route, json=get_full_data())
88
85
  assert response.status_code == 200
89
86
  crs_list = response.json["crs_list"]
90
87
  assert type(crs_list) is list
91
88
  for crs in crs_list:
92
89
  assert type(crs) is dict
93
90
 
94
- # Test without geode_object
95
- response = client.post(route, json={})
96
- assert response.status_code == 400
97
- error_message = response.json["description"]
98
- assert (
99
- error_message == "Validation error: 'input_geode_object' is a required property"
100
- )
91
+ # Test all params
92
+ test_utils.test_route_wrong_params(client, route, get_full_data)
101
93
 
102
94
 
103
95
  def test_inspect_file(client):
@@ -117,13 +109,8 @@ def test_inspect_file(client):
117
109
  inspection_result = response.json["inspection_result"]
118
110
  assert type(inspection_result) is dict
119
111
 
120
- for key, value in get_full_data().items():
121
- json = get_full_data()
122
- json.pop(key)
123
- response = client.post(route, json=json)
124
- assert response.status_code == 400
125
- error_description = response.json["description"]
126
- assert error_description == f"Validation error: '{key}' is a required property"
112
+ # Test all params
113
+ test_utils.test_route_wrong_params(client, route, get_full_data)
127
114
 
128
115
 
129
116
  def test_geode_objects_and_output_extensions(client):
@@ -148,13 +135,8 @@ def test_geode_objects_and_output_extensions(client):
148
135
  assert type(value) is dict
149
136
  assert type(value["is_saveable"]) is bool
150
137
 
151
- # Test without input_geode_object
152
- response = client.post(route, json={})
153
- assert response.status_code == 400
154
- error_message = response.json["description"]
155
- assert (
156
- error_message == "Validation error: 'input_geode_object' is a required property"
157
- )
138
+ # Test all params
139
+ test_utils.test_route_wrong_params(client, route, get_full_data)
158
140
 
159
141
 
160
142
  def test_save_viewable_file(client):
@@ -178,20 +160,66 @@ def test_save_viewable_file(client):
178
160
  id = response.json["id"]
179
161
  assert type(id) is str
180
162
 
181
- for key, value in get_full_data().items():
182
- json = get_full_data()
183
- json.pop(key)
184
- response = client.post(route, json=json)
185
- assert response.status_code == 400
186
- error_description = response.json["description"]
187
- assert error_description == f"Validation error: '{key}' is a required property"
163
+ # Test all params
164
+ test_utils.test_route_wrong_params(client, route, get_full_data)
188
165
 
189
166
 
190
- def test_create_point(client):
191
- route = f"/create_point"
167
+ def test_vertex_attribute_names(client):
168
+ response = client.put(
169
+ f"/upload_file",
170
+ data={"file": FileStorage(open("./tests/vertex_attribute.vtp", "rb"))},
171
+ )
172
+ assert response.status_code == 201
173
+
174
+ route = f"/vertex_attribute_names"
175
+
176
+ def get_full_data():
177
+ return {
178
+ "input_geode_object": "PolygonalSurface3D",
179
+ "filename": "vertex_attribute.vtp",
180
+ }
181
+
182
+ # Normal test with filename 'vertex_attribute.vtp'
183
+ response = client.post(route, json=get_full_data())
184
+ assert response.status_code == 200
185
+ vertex_attribute_names = response.json["vertex_attribute_names"]
186
+ assert type(vertex_attribute_names) is list
187
+ for vertex_attribute_name in vertex_attribute_names:
188
+ assert type(vertex_attribute_name) is str
189
+
190
+ test_utils.test_route_wrong_params(client, route, get_full_data)
191
+
192
+
193
+ def test_polygon_attribute_names(client):
194
+ response = client.put(
195
+ f"/upload_file",
196
+ data={"file": FileStorage(open("./tests/polygon_attribute.vtp", "rb"))},
197
+ )
198
+ assert response.status_code == 201
199
+
200
+ route = f"/polygon_attribute_names"
192
201
 
193
202
  def get_full_data():
194
- return {"x": 1, "y": 2, "z": 3}
203
+ return {
204
+ "input_geode_object": "PolygonalSurface3D",
205
+ "filename": "polygon_attribute.vtp",
206
+ }
207
+
208
+ # Normal test with filename 'vertex_attribute.vtp'
209
+ response = client.post(route, json=get_full_data())
210
+ assert response.status_code == 200
211
+ polygon_attribute_names = response.json["polygon_attribute_names"]
212
+ assert type(polygon_attribute_names) is list
213
+ for polygon_attribute_name in polygon_attribute_names:
214
+ assert type(polygon_attribute_name) is str
215
+
216
+ # Test all params
217
+ test_utils.test_route_wrong_params(client, route, get_full_data)
218
+
219
+
220
+ def test_create_point(client):
221
+ route = f"/create_point"
222
+ get_full_data = lambda: {"x": 1, "y": 2, "z": 3}
195
223
 
196
224
  # Normal test with all keys
197
225
  response = client.post(route, json=get_full_data())
@@ -201,10 +229,5 @@ def test_create_point(client):
201
229
  id = response.json["id"]
202
230
  assert type(id) is str
203
231
 
204
- for key, value in get_full_data().items():
205
- json = get_full_data()
206
- json.pop(key)
207
- response = client.post(route, json=json)
208
- assert response.status_code == 400
209
- error_description = response.json["description"]
210
- assert error_description == f"Validation error: '{key}' is a required property"
232
+ # Test all params
233
+ test_utils.test_route_wrong_params(client, route, get_full_data)
@@ -1,4 +1,9 @@
1
+ # Standard library imports
2
+
3
+ # Third party imports
1
4
  import flask
5
+
6
+ # Local application imports
2
7
  from src.opengeodeweb_back import utils_functions
3
8
 
4
9
 
@@ -1,28 +0,0 @@
1
- asgiref==3.8.1
2
- attrs==24.2.0
3
- blinker==1.8.2
4
- click==8.1.7
5
- flask[async]==3.0.3
6
- flask-cors==5.0.0
7
- geode-background==8.7.0
8
- geode-common==33.0.9
9
- geode-conversion==6.0.14
10
- geode-explicit==6.1.14
11
- geode-implicit==3.3.2
12
- geode-numerics==5.1.8
13
- geode-simplex==8.2.15
14
- geode-viewables==3.0.6
15
- itsdangerous==2.2.0
16
- jinja2==3.1.4
17
- jsonschema==4.23.0
18
- jsonschema-specifications==2024.10.1
19
- markupsafe==3.0.2
20
- opengeode-core==15.6.3
21
- opengeode-geosciences==8.1.1
22
- opengeode-geosciencesio==5.2.3
23
- opengeode-inspector==6.1.12
24
- opengeode-io==7.0.5
25
- referencing==0.35.1
26
- rpds-py==0.21.0
27
- typing-extensions==4.12.2
28
- werkzeug==3.1.2