OpenGeodeWeb-Back 5.9.0rc1__tar.gz → 5.9.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 (41) hide show
  1. {opengeodeweb_back-5.9.0rc1/src/OpenGeodeWeb_Back.egg-info → opengeodeweb_back-5.9.0rc2}/PKG-INFO +15 -19
  2. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/pyproject.toml +1 -1
  3. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/requirements.txt +16 -30
  4. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2/src/OpenGeodeWeb_Back.egg-info}/PKG-INFO +15 -19
  5. opengeodeweb_back-5.9.0rc2/src/OpenGeodeWeb_Back.egg-info/requires.txt +23 -0
  6. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/geode_functions.py +2 -2
  7. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/geode_objects.py +25 -25
  8. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/routes/blueprint_routes.py +20 -14
  9. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/utils_functions.py +62 -13
  10. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/tests/test_geode_functions.py +27 -35
  11. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/tests/test_routes.py +4 -6
  12. opengeodeweb_back-5.9.0rc2/tests/test_utils_functions.py +157 -0
  13. opengeodeweb_back-5.9.0rc1/src/OpenGeodeWeb_Back.egg-info/requires.txt +0 -27
  14. opengeodeweb_back-5.9.0rc1/tests/test_utils_functions.py +0 -93
  15. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/LICENSE +0 -0
  16. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/README.md +0 -0
  17. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/setup.cfg +0 -0
  18. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/OpenGeodeWeb_Back.egg-info/SOURCES.txt +0 -0
  19. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/OpenGeodeWeb_Back.egg-info/dependency_links.txt +0 -0
  20. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/OpenGeodeWeb_Back.egg-info/top_level.txt +0 -0
  21. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/__init__.py +0 -0
  22. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/app_config.py +0 -0
  23. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/routes/models/blueprint_models.py +0 -0
  24. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/routes/models/schemas/mesh_components.json +0 -0
  25. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/routes/models/schemas/vtm_component_indices.json +0 -0
  26. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/routes/schemas/allowed_files.json +0 -0
  27. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/routes/schemas/allowed_objects.json +0 -0
  28. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/routes/schemas/create_point.json +0 -0
  29. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/routes/schemas/geode_objects_and_output_extensions.json +0 -0
  30. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/routes/schemas/geographic_coordinate_systems.json +0 -0
  31. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/routes/schemas/inspect_file.json +0 -0
  32. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/routes/schemas/missing_files.json +0 -0
  33. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/routes/schemas/ping.json +0 -0
  34. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/routes/schemas/polygon_attribute_names.json +0 -0
  35. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/routes/schemas/polyhedron_attribute_names.json +0 -0
  36. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/routes/schemas/save_viewable_file.json +0 -0
  37. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/routes/schemas/texture_coordinates.json +0 -0
  38. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/routes/schemas/upload_file.json +0 -0
  39. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/routes/schemas/vertex_attribute_names.json +0 -0
  40. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/src/opengeodeweb_back/test_utils.py +0 -0
  41. {opengeodeweb_back-5.9.0rc1 → opengeodeweb_back-5.9.0rc2}/tests/test_models_routes.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OpenGeodeWeb-Back
3
- Version: 5.9.0rc1
3
+ Version: 5.9.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
@@ -11,32 +11,28 @@ Classifier: Operating System :: OS Independent
11
11
  Requires-Python: <3.13,>=3.9
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
- Requires-Dist: asgiref==3.8.1
15
- Requires-Dist: attrs==25.3.0
14
+ Requires-Dist: asgiref==3.9.1
16
15
  Requires-Dist: blinker==1.9.0
17
16
  Requires-Dist: click==8.2.1
18
17
  Requires-Dist: fastjsonschema==2.21.1
19
18
  Requires-Dist: flask[async]==3.1.1
20
19
  Requires-Dist: flask-cors==6.0.1
21
- Requires-Dist: geode-background==9.2.9
22
- Requires-Dist: geode-common==33.8.8
23
- Requires-Dist: geode-conversion==6.3.3
24
- Requires-Dist: geode-explicit==6.2.3
25
- Requires-Dist: geode-implicit==3.9.4
26
- Requires-Dist: geode-numerics==6.2.2
27
- Requires-Dist: geode-simplex==9.4.2
28
- Requires-Dist: geode-viewables==3.1.4
20
+ Requires-Dist: geode-background==9.4.0
21
+ Requires-Dist: geode-common==33.9.0
22
+ Requires-Dist: geode-conversion==6.4.0
23
+ Requires-Dist: geode-explicit==6.3.0
24
+ Requires-Dist: geode-implicit==4.1.1
25
+ Requires-Dist: geode-numerics==6.3.0
26
+ Requires-Dist: geode-simplex==9.6.0
27
+ Requires-Dist: geode-viewables==3.2.0
29
28
  Requires-Dist: itsdangerous==2.2.0
30
29
  Requires-Dist: jinja2==3.1.6
31
30
  Requires-Dist: markupsafe==3.0.2
32
- Requires-Dist: opengeode-core==15.21.2
33
- Requires-Dist: opengeode-geosciences==9.0.0
34
- Requires-Dist: opengeode-geosciencesio==5.4.2
35
- Requires-Dist: opengeode-inspector==6.6.1
36
- Requires-Dist: opengeode-io==7.2.1
37
- Requires-Dist: referencing==0.36.2
38
- Requires-Dist: rpds-py==0.25.1
39
- Requires-Dist: typing-extensions==4.14.0
31
+ Requires-Dist: opengeode-core==15.24.1
32
+ Requires-Dist: opengeode-geosciences==9.2.1
33
+ Requires-Dist: opengeode-geosciencesio==5.7.1
34
+ Requires-Dist: opengeode-inspector==6.7.0
35
+ Requires-Dist: opengeode-io==7.3.1
40
36
  Requires-Dist: werkzeug==3.1.3
41
37
  Dynamic: license-file
42
38
 
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
 
6
6
  [project]
7
7
  name = "OpenGeodeWeb-Back"
8
- version = "5.9.0-rc.1"
8
+ version = "5.9.0-rc.2"
9
9
  dynamic = ["dependencies"]
10
10
  authors = [
11
11
  { name="Geode-solutions", email="team-web@geode-solutions.com" },
@@ -4,30 +4,26 @@
4
4
  #
5
5
  # pip-compile requirements.in
6
6
  #
7
- asgiref==3.8.1
7
+ asgiref==3.9.1
8
8
  # via flask
9
- attrs==25.3.0
10
- # via
11
- # jsonschema
12
- # referencing
13
9
  blinker==1.9.0
14
10
  # via flask
15
11
  click==8.2.1
16
12
  # via flask
17
13
  fastjsonschema==2.21.1
18
- # via -r requirements.in
14
+ # via -r requirements.in
19
15
  flask[async]==3.1.1
20
16
  # via
21
17
  # -r requirements.in
22
18
  # flask-cors
23
19
  flask-cors==6.0.1
24
20
  # via -r requirements.in
25
- geode-background==9.2.9
21
+ geode-background==9.4.0
26
22
  # via
27
23
  # geode-explicit
28
24
  # geode-implicit
29
25
  # geode-simplex
30
- geode-common==33.8.8
26
+ geode-common==33.9.0
31
27
  # via
32
28
  # -r requirements.in
33
29
  # geode-background
@@ -37,26 +33,26 @@ geode-common==33.8.8
37
33
  # geode-numerics
38
34
  # geode-simplex
39
35
  # geode-viewables
40
- geode-conversion==6.3.3
36
+ geode-conversion==6.4.0
41
37
  # via
42
38
  # geode-explicit
43
39
  # geode-implicit
44
- geode-explicit==6.2.3
40
+ geode-explicit==6.3.0
45
41
  # via
46
42
  # -r requirements.in
47
43
  # geode-implicit
48
- geode-implicit==3.9.4
44
+ geode-implicit==4.1.1
49
45
  # via -r requirements.in
50
- geode-numerics==6.2.2
46
+ geode-numerics==6.3.0
51
47
  # via
52
48
  # -r requirements.in
53
49
  # geode-implicit
54
50
  # geode-simplex
55
- geode-simplex==9.4.2
51
+ geode-simplex==9.6.0
56
52
  # via
57
53
  # -r requirements.in
58
54
  # geode-implicit
59
- geode-viewables==3.1.4
55
+ geode-viewables==3.2.0
60
56
  # via -r requirements.in
61
57
  itsdangerous==2.2.0
62
58
  # via flask
@@ -67,7 +63,7 @@ markupsafe==3.0.2
67
63
  # flask
68
64
  # jinja2
69
65
  # werkzeug
70
- opengeode-core==15.21.2
66
+ opengeode-core==15.24.1
71
67
  # via
72
68
  # -r requirements.in
73
69
  # geode-background
@@ -82,40 +78,30 @@ opengeode-core==15.21.2
82
78
  # opengeode-geosciencesio
83
79
  # opengeode-inspector
84
80
  # opengeode-io
85
- opengeode-geosciences==9.0.0
81
+ opengeode-geosciences==9.2.1
86
82
  # via
87
83
  # -r requirements.in
88
84
  # geode-implicit
89
85
  # geode-viewables
90
86
  # opengeode-geosciencesio
91
- opengeode-geosciencesio==5.4.2
87
+ opengeode-geosciencesio==5.7.1
92
88
  # via
93
89
  # -r requirements.in
94
90
  # geode-implicit
95
- opengeode-inspector==6.6.1
91
+ opengeode-inspector==6.7.0
96
92
  # via
97
93
  # -r requirements.in
98
94
  # geode-explicit
99
95
  # geode-implicit
100
96
  # geode-simplex
101
- opengeode-io==7.2.1
97
+ opengeode-io==7.3.1
102
98
  # via
103
99
  # -r requirements.in
104
100
  # geode-implicit
105
101
  # geode-viewables
106
102
  # opengeode-geosciencesio
107
- referencing==0.36.2
108
- # via
109
- # jsonschema
110
- # jsonschema-specifications
111
- rpds-py==0.25.1
112
- # via
113
- # jsonschema
114
- # referencing
115
- typing-extensions==4.14.0
116
- # via referencing
117
103
  werkzeug==3.1.3
118
104
  # via
119
105
  # -r requirements.in
120
106
  # flask
121
- # flask-cors
107
+ # flask-cors
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OpenGeodeWeb-Back
3
- Version: 5.9.0rc1
3
+ Version: 5.9.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
@@ -11,32 +11,28 @@ Classifier: Operating System :: OS Independent
11
11
  Requires-Python: <3.13,>=3.9
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
- Requires-Dist: asgiref==3.8.1
15
- Requires-Dist: attrs==25.3.0
14
+ Requires-Dist: asgiref==3.9.1
16
15
  Requires-Dist: blinker==1.9.0
17
16
  Requires-Dist: click==8.2.1
18
17
  Requires-Dist: fastjsonschema==2.21.1
19
18
  Requires-Dist: flask[async]==3.1.1
20
19
  Requires-Dist: flask-cors==6.0.1
21
- Requires-Dist: geode-background==9.2.9
22
- Requires-Dist: geode-common==33.8.8
23
- Requires-Dist: geode-conversion==6.3.3
24
- Requires-Dist: geode-explicit==6.2.3
25
- Requires-Dist: geode-implicit==3.9.4
26
- Requires-Dist: geode-numerics==6.2.2
27
- Requires-Dist: geode-simplex==9.4.2
28
- Requires-Dist: geode-viewables==3.1.4
20
+ Requires-Dist: geode-background==9.4.0
21
+ Requires-Dist: geode-common==33.9.0
22
+ Requires-Dist: geode-conversion==6.4.0
23
+ Requires-Dist: geode-explicit==6.3.0
24
+ Requires-Dist: geode-implicit==4.1.1
25
+ Requires-Dist: geode-numerics==6.3.0
26
+ Requires-Dist: geode-simplex==9.6.0
27
+ Requires-Dist: geode-viewables==3.2.0
29
28
  Requires-Dist: itsdangerous==2.2.0
30
29
  Requires-Dist: jinja2==3.1.6
31
30
  Requires-Dist: markupsafe==3.0.2
32
- Requires-Dist: opengeode-core==15.21.2
33
- Requires-Dist: opengeode-geosciences==9.0.0
34
- Requires-Dist: opengeode-geosciencesio==5.4.2
35
- Requires-Dist: opengeode-inspector==6.6.1
36
- Requires-Dist: opengeode-io==7.2.1
37
- Requires-Dist: referencing==0.36.2
38
- Requires-Dist: rpds-py==0.25.1
39
- Requires-Dist: typing-extensions==4.14.0
31
+ Requires-Dist: opengeode-core==15.24.1
32
+ Requires-Dist: opengeode-geosciences==9.2.1
33
+ Requires-Dist: opengeode-geosciencesio==5.7.1
34
+ Requires-Dist: opengeode-inspector==6.7.0
35
+ Requires-Dist: opengeode-io==7.3.1
40
36
  Requires-Dist: werkzeug==3.1.3
41
37
  Dynamic: license-file
42
38
 
@@ -0,0 +1,23 @@
1
+ asgiref==3.9.1
2
+ blinker==1.9.0
3
+ click==8.2.1
4
+ fastjsonschema==2.21.1
5
+ flask[async]==3.1.1
6
+ flask-cors==6.0.1
7
+ geode-background==9.4.0
8
+ geode-common==33.9.0
9
+ geode-conversion==6.4.0
10
+ geode-explicit==6.3.0
11
+ geode-implicit==4.1.1
12
+ geode-numerics==6.3.0
13
+ geode-simplex==9.6.0
14
+ geode-viewables==3.2.0
15
+ itsdangerous==2.2.0
16
+ jinja2==3.1.6
17
+ markupsafe==3.0.2
18
+ opengeode-core==15.24.1
19
+ opengeode-geosciences==9.2.1
20
+ opengeode-geosciencesio==5.7.1
21
+ opengeode-inspector==6.7.0
22
+ opengeode-io==7.3.1
23
+ werkzeug==3.1.3
@@ -28,8 +28,8 @@ def output_factory(geode_object: str):
28
28
  return geode_object_value(geode_object)["output_factory"]
29
29
 
30
30
 
31
- def missing_files(geode_object: str, file_absolute_path: str):
32
- return geode_object_value(geode_object)["missing_files"](file_absolute_path)
31
+ def additional_files(geode_object: str, file_absolute_path: str):
32
+ return geode_object_value(geode_object)["additional_files"](file_absolute_path)
33
33
 
34
34
 
35
35
  def is_loadable(geode_object: str, file_absolute_path: str):
@@ -25,7 +25,7 @@ def geode_objects_dict():
25
25
  "class": og.BRep,
26
26
  "input_factory": og.BRepInputFactory,
27
27
  "output_factory": og.BRepOutputFactory,
28
- "missing_files": og.check_brep_missing_files,
28
+ "additional_files": og.brep_additional_files,
29
29
  "is_loadable": og.is_brep_loadable,
30
30
  "load": og.load_brep,
31
31
  "is_saveable": og.is_brep_saveable,
@@ -48,7 +48,7 @@ def geode_objects_dict():
48
48
  "class": og_gs.CrossSection,
49
49
  "input_factory": og_gs.CrossSectionInputFactory,
50
50
  "output_factory": og_gs.CrossSectionOutputFactory,
51
- "missing_files": og_gs.check_cross_section_missing_files,
51
+ "additional_files": og_gs.cross_section_additional_files,
52
52
  "is_loadable": og_gs.is_cross_section_loadable,
53
53
  "load": og_gs.load_cross_section,
54
54
  "is_saveable": og_gs.is_cross_section_saveable,
@@ -70,7 +70,7 @@ def geode_objects_dict():
70
70
  "class": og.EdgedCurve2D,
71
71
  "input_factory": og.EdgedCurveInputFactory2D,
72
72
  "output_factory": og.EdgedCurveOutputFactory2D,
73
- "missing_files": og.check_edged_curve_missing_files2D,
73
+ "additional_files": og.edged_curve_additional_files2D,
74
74
  "is_loadable": og.is_edged_curve_loadable2D,
75
75
  "load": og.load_edged_curve2D,
76
76
  "is_saveable": og.is_edged_curve_saveable2D,
@@ -93,7 +93,7 @@ def geode_objects_dict():
93
93
  "class": og.EdgedCurve3D,
94
94
  "input_factory": og.EdgedCurveInputFactory3D,
95
95
  "output_factory": og.EdgedCurveOutputFactory3D,
96
- "missing_files": og.check_edged_curve_missing_files3D,
96
+ "additional_files": og.edged_curve_additional_files3D,
97
97
  "is_loadable": og.is_edged_curve_loadable3D,
98
98
  "load": og.load_edged_curve3D,
99
99
  "is_saveable": og.is_edged_curve_saveable3D,
@@ -116,7 +116,7 @@ def geode_objects_dict():
116
116
  "class": og.Graph,
117
117
  "input_factory": og.GraphInputFactory,
118
118
  "output_factory": og.GraphOutputFactory,
119
- "missing_files": og.check_graph_missing_files,
119
+ "additional_files": og.graph_additional_files,
120
120
  "is_loadable": og.is_graph_loadable,
121
121
  "load": og.load_graph,
122
122
  "is_saveable": og.is_graph_saveable,
@@ -130,7 +130,7 @@ def geode_objects_dict():
130
130
  "class": og.HybridSolid3D,
131
131
  "input_factory": og.HybridSolidInputFactory3D,
132
132
  "output_factory": og.HybridSolidOutputFactory3D,
133
- "missing_files": og.check_hybrid_solid_missing_files3D,
133
+ "additional_files": og.hybrid_solid_additional_files3D,
134
134
  "is_loadable": og.is_hybrid_solid_loadable3D,
135
135
  "load": og.load_hybrid_solid3D,
136
136
  "is_saveable": og.is_hybrid_solid_saveable3D,
@@ -154,7 +154,7 @@ def geode_objects_dict():
154
154
  "class": og_gs.ImplicitCrossSection,
155
155
  "input_factory": og_gs.ImplicitCrossSectionInputFactory,
156
156
  "output_factory": og_gs.ImplicitCrossSectionOutputFactory,
157
- "missing_files": og_gs.check_implicit_cross_section_missing_files,
157
+ "additional_files": og_gs.implicit_cross_section_additional_files,
158
158
  "is_loadable": og_gs.is_implicit_cross_section_loadable,
159
159
  "load": og_gs.load_implicit_cross_section,
160
160
  "is_saveable": og_gs.is_implicit_cross_section_saveable,
@@ -177,7 +177,7 @@ def geode_objects_dict():
177
177
  "class": og_gs.ImplicitStructuralModel,
178
178
  "input_factory": og_gs.ImplicitStructuralModelInputFactory,
179
179
  "output_factory": og_gs.ImplicitStructuralModelOutputFactory,
180
- "missing_files": og_gs.check_implicit_structural_model_missing_files,
180
+ "additional_files": og_gs.implicit_structural_model_additional_files,
181
181
  "is_loadable": og_gs.is_implicit_structural_model_loadable,
182
182
  "load": og_gs.load_implicit_structural_model,
183
183
  "is_saveable": og_gs.is_implicit_structural_model_saveable,
@@ -199,7 +199,7 @@ def geode_objects_dict():
199
199
  "class": og.LightRegularGrid2D,
200
200
  "input_factory": og.LightRegularGridInputFactory2D,
201
201
  "output_factory": og.LightRegularGridOutputFactory2D,
202
- "missing_files": og.check_light_regular_grid_missing_files2D,
202
+ "additional_files": og.light_regular_grid_additional_files2D,
203
203
  "is_loadable": og.is_light_regular_grid_loadable2D,
204
204
  "load": og.load_light_regular_grid2D,
205
205
  "is_saveable": og.is_light_regular_grid_saveable2D,
@@ -215,7 +215,7 @@ def geode_objects_dict():
215
215
  "class": og.LightRegularGrid3D,
216
216
  "input_factory": og.LightRegularGridInputFactory3D,
217
217
  "output_factory": og.LightRegularGridOutputFactory3D,
218
- "missing_files": og.check_light_regular_grid_missing_files3D,
218
+ "additional_files": og.light_regular_grid_additional_files3D,
219
219
  "is_loadable": og.is_light_regular_grid_loadable3D,
220
220
  "load": og.load_light_regular_grid3D,
221
221
  "is_saveable": og.is_light_regular_grid_saveable3D,
@@ -231,7 +231,7 @@ def geode_objects_dict():
231
231
  "class": og.PointSet2D,
232
232
  "input_factory": og.PointSetInputFactory2D,
233
233
  "output_factory": og.PointSetOutputFactory2D,
234
- "missing_files": og.check_point_set_missing_files2D,
234
+ "additional_files": og.point_set_additional_files2D,
235
235
  "is_loadable": og.is_point_set_loadable2D,
236
236
  "load": og.load_point_set2D,
237
237
  "is_saveable": og.is_point_set_saveable2D,
@@ -254,7 +254,7 @@ def geode_objects_dict():
254
254
  "class": og.PointSet3D,
255
255
  "input_factory": og.PointSetInputFactory3D,
256
256
  "output_factory": og.PointSetOutputFactory3D,
257
- "missing_files": og.check_point_set_missing_files3D,
257
+ "additional_files": og.point_set_additional_files3D,
258
258
  "is_loadable": og.is_point_set_loadable3D,
259
259
  "load": og.load_point_set3D,
260
260
  "is_saveable": og.is_point_set_saveable3D,
@@ -277,7 +277,7 @@ def geode_objects_dict():
277
277
  "class": og.PolygonalSurface2D,
278
278
  "input_factory": og.PolygonalSurfaceInputFactory2D,
279
279
  "output_factory": og.PolygonalSurfaceOutputFactory2D,
280
- "missing_files": og.check_polygonal_surface_missing_files2D,
280
+ "additional_files": og.polygonal_surface_additional_files2D,
281
281
  "is_loadable": og.is_polygonal_surface_loadable2D,
282
282
  "load": og.load_polygonal_surface2D,
283
283
  "is_saveable": og.is_polygonal_surface_saveable2D,
@@ -300,7 +300,7 @@ def geode_objects_dict():
300
300
  "class": og.PolygonalSurface3D,
301
301
  "input_factory": og.PolygonalSurfaceInputFactory3D,
302
302
  "output_factory": og.PolygonalSurfaceOutputFactory3D,
303
- "missing_files": og.check_polygonal_surface_missing_files3D,
303
+ "additional_files": og.polygonal_surface_additional_files3D,
304
304
  "is_loadable": og.is_polygonal_surface_loadable3D,
305
305
  "load": og.load_polygonal_surface3D,
306
306
  "is_saveable": og.is_polygonal_surface_saveable3D,
@@ -323,7 +323,7 @@ def geode_objects_dict():
323
323
  "class": og.PolyhedralSolid3D,
324
324
  "input_factory": og.PolyhedralSolidInputFactory3D,
325
325
  "output_factory": og.PolyhedralSolidOutputFactory3D,
326
- "missing_files": og.check_polyhedral_solid_missing_files3D,
326
+ "additional_files": og.polyhedral_solid_additional_files3D,
327
327
  "is_loadable": og.is_polyhedral_solid_loadable3D,
328
328
  "load": og.load_polyhedral_solid3D,
329
329
  "is_saveable": og.is_polyhedral_solid_saveable3D,
@@ -346,7 +346,7 @@ def geode_objects_dict():
346
346
  "class": og.RasterImage2D,
347
347
  "input_factory": og.RasterImageInputFactory2D,
348
348
  "output_factory": og.RasterImageOutputFactory2D,
349
- "missing_files": og.check_raster_image_missing_files2D,
349
+ "additional_files": og.raster_image_additional_files2D,
350
350
  "is_loadable": og.is_raster_image_loadable2D,
351
351
  "load": og.load_raster_image2D,
352
352
  "is_saveable": og.is_raster_image_saveable2D,
@@ -360,7 +360,7 @@ def geode_objects_dict():
360
360
  "class": og.RasterImage3D,
361
361
  "input_factory": og.RasterImageInputFactory3D,
362
362
  "output_factory": og.RasterImageOutputFactory3D,
363
- "missing_files": og.check_raster_image_missing_files3D,
363
+ "additional_files": og.raster_image_additional_files3D,
364
364
  "is_loadable": og.is_raster_image_loadable3D,
365
365
  "load": og.load_raster_image3D,
366
366
  "is_saveable": og.is_raster_image_saveable3D,
@@ -374,7 +374,7 @@ def geode_objects_dict():
374
374
  "class": og.RegularGrid2D,
375
375
  "input_factory": og.RegularGridInputFactory2D,
376
376
  "output_factory": og.RegularGridOutputFactory2D,
377
- "missing_files": og.check_regular_grid_missing_files2D,
377
+ "additional_files": og.regular_grid_additional_files2D,
378
378
  "is_loadable": og.is_regular_grid_loadable2D,
379
379
  "load": og.load_regular_grid2D,
380
380
  "is_saveable": og.is_regular_grid_saveable2D,
@@ -396,7 +396,7 @@ def geode_objects_dict():
396
396
  "class": og.RegularGrid3D,
397
397
  "input_factory": og.RegularGridInputFactory3D,
398
398
  "output_factory": og.RegularGridOutputFactory3D,
399
- "missing_files": og.check_regular_grid_missing_files3D,
399
+ "additional_files": og.regular_grid_additional_files3D,
400
400
  "is_loadable": og.is_regular_grid_loadable3D,
401
401
  "load": og.load_regular_grid3D,
402
402
  "is_saveable": og.is_regular_grid_saveable3D,
@@ -418,7 +418,7 @@ def geode_objects_dict():
418
418
  "class": og.Section,
419
419
  "input_factory": og.SectionInputFactory,
420
420
  "output_factory": og.SectionOutputFactory,
421
- "missing_files": og.check_section_missing_files,
421
+ "additional_files": og.section_additional_files,
422
422
  "is_loadable": og.is_section_loadable,
423
423
  "load": og.load_section,
424
424
  "is_saveable": og.is_section_saveable,
@@ -441,7 +441,7 @@ def geode_objects_dict():
441
441
  "class": og_gs.StructuralModel,
442
442
  "input_factory": og_gs.StructuralModelInputFactory,
443
443
  "output_factory": og_gs.StructuralModelOutputFactory,
444
- "missing_files": og_gs.check_structural_model_missing_files,
444
+ "additional_files": og_gs.structural_model_additional_files,
445
445
  "is_loadable": og_gs.is_structural_model_loadable,
446
446
  "load": og_gs.load_structural_model,
447
447
  "is_saveable": og_gs.is_structural_model_saveable,
@@ -463,7 +463,7 @@ def geode_objects_dict():
463
463
  "class": og.TetrahedralSolid3D,
464
464
  "input_factory": og.TetrahedralSolidInputFactory3D,
465
465
  "output_factory": og.TetrahedralSolidOutputFactory3D,
466
- "missing_files": og.check_tetrahedral_solid_missing_files3D,
466
+ "additional_files": og.tetrahedral_solid_additional_files3D,
467
467
  "is_loadable": og.is_tetrahedral_solid_loadable3D,
468
468
  "load": og.load_tetrahedral_solid3D,
469
469
  "is_saveable": og.is_tetrahedral_solid_saveable3D,
@@ -486,7 +486,7 @@ def geode_objects_dict():
486
486
  "class": og.TriangulatedSurface2D,
487
487
  "input_factory": og.TriangulatedSurfaceInputFactory2D,
488
488
  "output_factory": og.TriangulatedSurfaceOutputFactory2D,
489
- "missing_files": og.check_triangulated_surface_missing_files2D,
489
+ "additional_files": og.triangulated_surface_additional_files2D,
490
490
  "is_loadable": og.is_triangulated_surface_loadable2D,
491
491
  "load": og.load_triangulated_surface2D,
492
492
  "is_saveable": og.is_triangulated_surface_saveable2D,
@@ -509,7 +509,7 @@ def geode_objects_dict():
509
509
  "class": og.TriangulatedSurface3D,
510
510
  "input_factory": og.TriangulatedSurfaceInputFactory3D,
511
511
  "output_factory": og.TriangulatedSurfaceOutputFactory3D,
512
- "missing_files": og.check_triangulated_surface_missing_files3D,
512
+ "additional_files": og.triangulated_surface_additional_files3D,
513
513
  "is_loadable": og.is_triangulated_surface_loadable3D,
514
514
  "load": og.load_triangulated_surface3D,
515
515
  "is_saveable": og.is_triangulated_surface_saveable3D,
@@ -532,7 +532,7 @@ def geode_objects_dict():
532
532
  "class": og.VertexSet,
533
533
  "input_factory": og.VertexSetInputFactory,
534
534
  "output_factory": og.VertexSetOutputFactory,
535
- "missing_files": og.check_vertex_set_missing_files,
535
+ "additional_files": og.vertex_set_additional_files,
536
536
  "is_loadable": og.is_vertex_set_loadable,
537
537
  "load": og.load_vertex_set,
538
538
  "is_saveable": og.is_vertex_set_saveable,
@@ -121,19 +121,27 @@ with open(
121
121
  def missing_files():
122
122
  utils_functions.validate_request(flask.request, missing_files_json)
123
123
  file_path = geode_functions.upload_file_path(flask.request.json["filename"])
124
- missing_files = geode_functions.missing_files(
124
+
125
+ additional_files = geode_functions.additional_files(
125
126
  flask.request.json["input_geode_object"],
126
127
  file_path,
127
128
  )
128
- has_missing_files = missing_files.has_missing_files()
129
129
 
130
- mandatory_files = []
131
- for mandatory_file in missing_files.mandatory_files:
132
- mandatory_files.append(os.path.basename(mandatory_file))
130
+ has_missing_files = any(
131
+ file.is_missing
132
+ for file in additional_files.mandatory_files + additional_files.optional_files
133
+ )
133
134
 
134
- additional_files = []
135
- for additional_file in missing_files.additional_files:
136
- additional_files.append(os.path.basename(additional_file))
135
+ mandatory_files = [
136
+ os.path.basename(file.filename)
137
+ for file in additional_files.mandatory_files
138
+ if file.is_missing
139
+ ]
140
+ additional_files = [
141
+ os.path.basename(file.filename)
142
+ for file in additional_files.optional_files
143
+ if file.is_missing
144
+ ]
137
145
 
138
146
  return flask.make_response(
139
147
  {
@@ -239,12 +247,10 @@ with open(
239
247
  )
240
248
  def save_viewable_file():
241
249
  utils_functions.validate_request(flask.request, save_viewable_file_json)
242
-
243
- file_path = geode_functions.upload_file_path(flask.request.json["filename"])
244
- data = geode_functions.load(flask.request.json["input_geode_object"], file_path)
245
250
  return flask.make_response(
246
- utils_functions.generate_native_viewable_and_light_viewable(
247
- flask.request.json["input_geode_object"], data
251
+ utils_functions.generate_native_viewable_and_light_viewable_from_file(
252
+ geode_object=flask.request.json["input_geode_object"],
253
+ input_filename=flask.request.json["filename"],
248
254
  ),
249
255
  200,
250
256
  )
@@ -267,7 +273,7 @@ def create_point():
267
273
  builder.create_point(opengeode.Point3D([x, y, z]))
268
274
  builder.set_name(title)
269
275
  return flask.make_response(
270
- utils_functions.generate_native_viewable_and_light_viewable(
276
+ utils_functions.generate_native_viewable_and_light_viewable_from_object(
271
277
  "PointSet3D", PointSet3D
272
278
  ),
273
279
  200,
@@ -9,6 +9,8 @@ import zipfile
9
9
  import flask
10
10
  import fastjsonschema
11
11
  import importlib.metadata as metadata
12
+ import shutil
13
+ import werkzeug
12
14
 
13
15
  # Local application imports
14
16
  from . import geode_functions
@@ -143,13 +145,20 @@ def handle_exception(e):
143
145
  return response
144
146
 
145
147
 
146
- def generate_native_viewable_and_light_viewable(geode_object, data):
148
+ def create_unique_data_folder() -> tuple[str, str]:
149
+ base_data_folder = flask.current_app.config["DATA_FOLDER_PATH"]
147
150
  generated_id = str(uuid.uuid4()).replace("-", "")
148
- DATA_FOLDER_PATH = flask.current_app.config["DATA_FOLDER_PATH"]
149
- data_path = os.path.join(DATA_FOLDER_PATH, generated_id)
150
- name = data.name()
151
- object_type = geode_functions.get_object_type(geode_object)
151
+ data_path = os.path.join(base_data_folder, generated_id)
152
+ os.makedirs(data_path, exist_ok=True)
153
+ return generated_id, data_path
152
154
 
155
+
156
+ def save_all_viewables_and_return_info(
157
+ geode_object,
158
+ data, generated_id,
159
+ data_path,
160
+ additional_files=None
161
+ ):
153
162
  saved_native_file_path = geode_functions.save(
154
163
  geode_object,
155
164
  data,
@@ -159,20 +168,60 @@ def generate_native_viewable_and_light_viewable(geode_object, data):
159
168
  saved_viewable_file_path = geode_functions.save_viewable(
160
169
  geode_object, data, data_path, "viewable"
161
170
  )
162
- viewable_file_name = os.path.basename(saved_viewable_file_path)
163
171
  saved_light_viewable_file_path = geode_functions.save_light_viewable(
164
172
  geode_object, data, data_path, "light_viewable"
165
173
  )
166
- f = open(saved_light_viewable_file_path, "rb")
167
- binary_light_viewable = f.read()
168
- f.close()
174
+ with open(saved_light_viewable_file_path, "rb") as f:
175
+ binary_light_viewable = f.read()
169
176
 
170
177
  return {
171
- "name": name,
178
+ "name": data.name(),
172
179
  "native_file_name": os.path.basename(saved_native_file_path[0]),
173
- "viewable_file_name": viewable_file_name,
180
+ "viewable_file_name": os.path.basename(saved_viewable_file_path),
174
181
  "id": generated_id,
175
- "object_type": object_type,
176
- "binary_light_viewable": str(binary_light_viewable, "utf-8"),
182
+ "object_type": geode_functions.get_object_type(geode_object),
183
+ "binary_light_viewable": binary_light_viewable.decode("utf-8"),
177
184
  "geode_object": geode_object,
185
+ "input_files": additional_files or [],
178
186
  }
187
+
188
+ def generate_native_viewable_and_light_viewable_from_object(
189
+ geode_object,
190
+ data
191
+ ):
192
+ generated_id, data_path = create_unique_data_folder()
193
+ return save_all_viewables_and_return_info(geode_object, data, generated_id, data_path)
194
+
195
+
196
+ def generate_native_viewable_and_light_viewable_from_file(
197
+ geode_object,
198
+ input_filename
199
+ ):
200
+ generated_id, data_path = create_unique_data_folder()
201
+
202
+ full_input_filename = geode_functions.upload_file_path(input_filename)
203
+ copied_full_path = os.path.join(data_path, werkzeug.utils.secure_filename(input_filename))
204
+ shutil.copy2(full_input_filename, copied_full_path)
205
+
206
+ additional_files_copied = []
207
+ additional = geode_functions.additional_files(geode_object, full_input_filename)
208
+ for additional_file in additional.mandatory_files + additional.optional_files:
209
+ if additional_file.is_missing:
210
+ continue
211
+ source_path = os.path.join(os.path.dirname(full_input_filename), additional_file.filename)
212
+ if not os.path.exists(source_path):
213
+ continue
214
+ dest_path = os.path.join(data_path, additional_file.filename)
215
+ os.makedirs(os.path.dirname(dest_path), exist_ok=True)
216
+ shutil.copy2(source_path, dest_path)
217
+ additional_files_copied.append(additional_file.filename)
218
+
219
+ data = geode_functions.load_data(geode_object, generated_id, input_filename)
220
+
221
+ return save_all_viewables_and_return_info(
222
+ geode_object,
223
+ data,
224
+ generated_id,
225
+ data_path,
226
+ additional_files=additional_files_copied,
227
+ )
@@ -43,20 +43,18 @@ def test_output_factory():
43
43
  assert type(output) is str
44
44
 
45
45
 
46
- def test_missing_files():
46
+ def test_additional_files():
47
47
  for geode_object, value in geode_objects.geode_objects_dict().items():
48
48
  input_extensions = geode_functions.geode_object_input_extensions(geode_object)
49
49
  for input_extension in input_extensions:
50
50
  file_absolute_path = os.path.join(data_folder, f"test.{input_extension}")
51
- missing_files = geode_functions.missing_files(
51
+ additional_files = geode_functions.additional_files(
52
52
  geode_object, file_absolute_path
53
53
  )
54
- has_missing_files = missing_files.has_missing_files()
55
- assert type(has_missing_files) is bool
56
- mandatory_files = missing_files.mandatory_files
54
+ mandatory_files = additional_files.mandatory_files
55
+ optional_files = additional_files.optional_files
57
56
  assert type(mandatory_files) is list
58
- additional_files = missing_files.additional_files
59
- assert type(additional_files) is list
57
+ assert type(optional_files) is list
60
58
 
61
59
 
62
60
  def test_is_loadable():
@@ -75,19 +73,9 @@ def test_load():
75
73
  for input_extension in input_extensions:
76
74
  print(f"\t{input_extension=}")
77
75
  file_absolute_path = os.path.join(data_folder, f"test.{input_extension}")
78
- missing_files = geode_functions.missing_files(
79
- geode_object, file_absolute_path
80
- )
81
- has_missing_files = missing_files.has_missing_files()
82
- if has_missing_files:
83
- mandatory_files = missing_files.mandatory_files
84
- print(f"\t\t{mandatory_files=}")
85
- additional_files = missing_files.additional_files
86
- print(f"\t\t{additional_files=}")
87
76
  if geode_functions.is_loadable(geode_object, file_absolute_path):
88
77
  data = geode_functions.load(geode_object, file_absolute_path)
89
78
  data_name = data.name()
90
- uu_id = str(uuid.uuid4()).replace("-", "")
91
79
  if "save_viewable" in value:
92
80
  viewable_file_path = geode_functions.save_viewable(
93
81
  geode_object,
@@ -169,23 +157,27 @@ def test_geode_object_output_extensions():
169
157
  for input_extension in input_extensions:
170
158
  print(f"\t{input_extension=}")
171
159
  file_absolute_path = os.path.join(data_folder, f"test.{input_extension}")
172
- missing_files = geode_functions.missing_files(
160
+ additional = geode_functions.additional_files(
173
161
  geode_object, file_absolute_path
174
162
  )
175
- has_missing_files = missing_files.has_missing_files()
163
+ has_missing_files = any(
164
+ f.is_missing
165
+ for f in additional.mandatory_files + additional.optional_files
166
+ )
176
167
  if has_missing_files:
177
- mandatory_files = missing_files.mandatory_files
178
- print(f"\t\t{mandatory_files=}")
179
- additional_files = missing_files.additional_files
180
- print(f"\t\t{additional_files=}")
181
- file_absolute_path = os.path.join(data_folder, f"test.{input_extension}")
168
+ print(
169
+ f"\t\tMandatory files: {[f.filename for f in additional.mandatory_files]}"
170
+ )
171
+ print(
172
+ f"\t\tAdditional files: {[f.filename for f in additional.optional_files]}"
173
+ )
182
174
  if geode_functions.is_loadable(geode_object, file_absolute_path):
183
175
  data = geode_functions.load(geode_object, file_absolute_path)
184
176
  geode_objets_and_output_extensions = (
185
177
  geode_functions.geode_objects_output_extensions(geode_object, data)
186
178
  )
187
179
  data_name = data.name()
188
- assert type(geode_objets_and_output_extensions) is dict
180
+ assert isinstance(geode_objets_and_output_extensions, dict)
189
181
  for (
190
182
  output_geode_object,
191
183
  output_geode_object_value,
@@ -194,8 +186,8 @@ def test_geode_object_output_extensions():
194
186
  output_extension,
195
187
  output_extension_value,
196
188
  ) in output_geode_object_value.items():
197
- assert type(output_extension) is str
198
- assert type(output_extension_value["is_saveable"]) is bool
189
+ assert isinstance(output_extension, str)
190
+ assert isinstance(output_extension_value["is_saveable"], bool)
199
191
 
200
192
 
201
193
  def test_get_inspector_children():
@@ -210,18 +202,18 @@ def test_get_inspector_children():
210
202
  file_absolute_path = os.path.join(
211
203
  data_folder, f"test.{input_extension}"
212
204
  )
213
- missing_files = geode_functions.missing_files(
205
+ additional = geode_functions.additional_files(
214
206
  geode_object, file_absolute_path
215
207
  )
216
- has_missing_files = missing_files.has_missing_files()
208
+ has_missing_files = any(
209
+ f.is_missing
210
+ for f in additional.mandatory_files + additional.optional_files
211
+ )
217
212
  if has_missing_files:
218
- mandatory_files = missing_files.mandatory_files
213
+ mandatory_files = [f.filename for f in additional.mandatory_files]
219
214
  print(f"\t\t{mandatory_files=}", flush=True)
220
- additional_files = missing_files.additional_files
215
+ additional_files = [f.filename for f in additional.optional_files]
221
216
  print(f"\t\t{additional_files=}", flush=True)
222
- file_absolute_path = os.path.join(
223
- data_folder, f"test.{input_extension}"
224
- )
225
217
  if geode_functions.is_loadable(geode_object, file_absolute_path):
226
218
  data = geode_functions.load(geode_object, file_absolute_path)
227
219
  class_inspector = geode_functions.inspect(geode_object, data)
@@ -231,7 +223,7 @@ def test_get_inspector_children():
231
223
  )
232
224
 
233
225
  print(f"\t\t{inspection_result=}", flush=True)
234
- assert type(inspection_result) is dict
226
+ assert isinstance(inspection_result, dict)
235
227
 
236
228
 
237
229
  def test_filter_geode_objects():
@@ -45,12 +45,11 @@ def test_allowed_objects(client):
45
45
  test_utils.test_route_wrong_params(client, route, get_full_data)
46
46
 
47
47
 
48
- def test_upload_file(client, filename="corbi.og_brep"):
48
+ def test_upload_file(client, filename="test.og_brep"):
49
49
  response = client.put(
50
50
  f"/upload_file",
51
- data={"file": FileStorage(open(f"./tests/{filename}", "rb"))},
51
+ data={"file": FileStorage(open(f"./tests/data/{filename}", "rb"))},
52
52
  )
53
-
54
53
  assert response.status_code == 201
55
54
 
56
55
 
@@ -60,7 +59,7 @@ def test_missing_files(client):
60
59
  def get_full_data():
61
60
  return {
62
61
  "input_geode_object": "BRep",
63
- "filename": "corbi.og_brep",
62
+ "filename": "test.og_brep",
64
63
  }
65
64
 
66
65
  json = get_full_data()
@@ -140,7 +139,6 @@ def test_geode_objects_and_output_extensions(client):
140
139
 
141
140
 
142
141
  def test_save_viewable_file(client):
143
-
144
142
  test_upload_file(client, filename="corbi.og_brep")
145
143
  route = f"/save_viewable_file"
146
144
 
@@ -175,7 +173,7 @@ def test_texture_coordinates(client, test_id):
175
173
  with client.application.app_context():
176
174
  data_path = geode_functions.data_file_path(test_id, "hat.vtp")
177
175
  os.makedirs(os.path.dirname(data_path), exist_ok=True)
178
- shutil.copy("./tests/vertex_attribute.vtp", data_path)
176
+ shutil.copy("./tests/data/hat.vtp", data_path)
179
177
 
180
178
  response = client.post(
181
179
  "/texture_coordinates",
@@ -0,0 +1,157 @@
1
+ # Standard library imports
2
+ import re
3
+ import os
4
+
5
+ # Third party imports
6
+ import flask
7
+ import shutil
8
+
9
+ # Local application imports
10
+ from src.opengeodeweb_back import geode_functions, utils_functions
11
+
12
+
13
+ def test_increment_request_counter(app_context):
14
+ assert flask.current_app.config.get("REQUEST_COUNTER") == 0
15
+ utils_functions.increment_request_counter(flask.current_app)
16
+ assert flask.current_app.config.get("REQUEST_COUNTER") == 1
17
+
18
+
19
+ def test_decrement_request_counter(app_context):
20
+ assert flask.current_app.config.get("REQUEST_COUNTER") == 1
21
+ utils_functions.decrement_request_counter(flask.current_app)
22
+ assert flask.current_app.config.get("REQUEST_COUNTER") == 0
23
+
24
+
25
+ def test_update_last_request_time(app_context):
26
+ LAST_REQUEST_TIME = flask.current_app.config.get("LAST_REQUEST_TIME")
27
+ utils_functions.update_last_request_time(flask.current_app)
28
+ assert flask.current_app.config.get("LAST_REQUEST_TIME") >= LAST_REQUEST_TIME
29
+
30
+
31
+ def test_before_request(app_context):
32
+ assert flask.current_app.config.get("REQUEST_COUNTER") == 0
33
+ utils_functions.before_request(flask.current_app)
34
+ assert flask.current_app.config.get("REQUEST_COUNTER") == 1
35
+
36
+
37
+ def test_teardown_request(app_context):
38
+ LAST_REQUEST_TIME = flask.current_app.config.get("LAST_REQUEST_TIME")
39
+ assert flask.current_app.config.get("REQUEST_COUNTER") == 1
40
+ utils_functions.teardown_request(flask.current_app)
41
+ assert flask.current_app.config.get("REQUEST_COUNTER") == 0
42
+ assert flask.current_app.config.get("LAST_REQUEST_TIME") >= LAST_REQUEST_TIME
43
+
44
+
45
+ def test_versions():
46
+ list_packages = [
47
+ "OpenGeode-core",
48
+ "OpenGeode-IO",
49
+ "OpenGeode-Geosciences",
50
+ "OpenGeode-GeosciencesIO",
51
+ ]
52
+ versions = utils_functions.versions(list_packages)
53
+ assert type(versions) is list
54
+ for version in versions:
55
+ assert type(version) is dict
56
+
57
+
58
+ def test_extension_from_filename():
59
+ extension = utils_functions.extension_from_filename("test.toto")
60
+ assert type(extension) is str
61
+ assert extension.count(".") == 0
62
+
63
+
64
+ def test_handle_exception(client):
65
+ route = "/error"
66
+ response = client.post(route)
67
+ assert response.status_code == 500
68
+ data = response.get_json()
69
+ assert type(data) is dict
70
+ assert type(data["description"]) is str
71
+ assert type(data["name"]) is str
72
+ assert type(data["code"]) is int
73
+
74
+
75
+ def test_create_unique_data_folder(client):
76
+ app = client.application
77
+ with app.app_context():
78
+ generated_id, data_path = utils_functions.create_unique_data_folder()
79
+ assert isinstance(generated_id, str)
80
+ assert re.fullmatch(r"[0-9a-f]{32}", generated_id)
81
+ assert os.path.exists(data_path)
82
+ assert data_path.startswith(flask.current_app.config["DATA_FOLDER_PATH"])
83
+ assert generated_id in data_path
84
+ shutil.rmtree(data_path, ignore_errors=True)
85
+ assert not os.path.exists(data_path)
86
+
87
+
88
+
89
+ def test_save_all_viewables_and_return_info(client):
90
+ app = client.application
91
+ with app.app_context():
92
+ geode_object = "BRep"
93
+ data = geode_functions.load(geode_object, "./tests/data/test.og_brep")
94
+ generated_id, data_path = utils_functions.create_unique_data_folder()
95
+ additional_files = ["additional_file.txt"]
96
+
97
+ result = utils_functions.save_all_viewables_and_return_info(
98
+ geode_object, data, generated_id, data_path, additional_files
99
+ )
100
+
101
+ assert isinstance(result, dict)
102
+ assert result["name"] == data.name()
103
+ assert result["native_file_name"].startswith("native.")
104
+ assert result["viewable_file_name"].endswith(".vtm")
105
+ assert re.match(r"[0-9a-f]{32}", result["id"])
106
+ assert isinstance(result["object_type"], str)
107
+ assert isinstance(result["binary_light_viewable"], str)
108
+ assert result["geode_object"] == geode_object
109
+ assert result["input_files"] == additional_files
110
+
111
+
112
+ def test_generate_native_viewable_and_light_viewable_from_object(client):
113
+ app = client.application
114
+ with app.app_context():
115
+ geode_object = "BRep"
116
+ data = geode_functions.load(geode_object, "./tests/data/test.og_brep")
117
+
118
+ result = (
119
+ utils_functions.generate_native_viewable_and_light_viewable_from_object(
120
+ geode_object, data
121
+ )
122
+ )
123
+
124
+ assert isinstance(result, dict)
125
+ assert isinstance(result["name"], str)
126
+ assert isinstance(result["native_file_name"], str)
127
+ assert result["native_file_name"].startswith("native.")
128
+ assert isinstance(result["viewable_file_name"], str)
129
+ assert result["viewable_file_name"].endswith(".vtm")
130
+ assert isinstance(result["id"], str)
131
+ assert re.match(r"[0-9a-f]{32}", result["id"])
132
+ assert isinstance(result["object_type"], str)
133
+ assert isinstance(result["binary_light_viewable"], str)
134
+ assert result["input_files"] == []
135
+
136
+
137
+ def test_generate_native_viewable_and_light_viewable_from_file(client):
138
+ app = client.application
139
+ with app.app_context():
140
+ geode_object = "BRep"
141
+ input_filename = "test.og_brep"
142
+
143
+ result = utils_functions.generate_native_viewable_and_light_viewable_from_file(
144
+ geode_object, input_filename
145
+ )
146
+
147
+ assert isinstance(result, dict)
148
+ assert isinstance(result["name"], str)
149
+ assert isinstance(result["native_file_name"], str)
150
+ assert result["native_file_name"].startswith("native.")
151
+ assert isinstance(result["viewable_file_name"], str)
152
+ assert result["viewable_file_name"].endswith(".vtm")
153
+ assert isinstance(result["id"], str)
154
+ assert re.match(r"[0-9a-f]{32}", result["id"])
155
+ assert isinstance(result["object_type"], str)
156
+ assert isinstance(result["binary_light_viewable"], str)
157
+ assert isinstance(result["input_files"], list)
@@ -1,27 +0,0 @@
1
- asgiref==3.8.1
2
- attrs==25.3.0
3
- blinker==1.9.0
4
- click==8.2.1
5
- fastjsonschema==2.21.1
6
- flask[async]==3.1.1
7
- flask-cors==6.0.1
8
- geode-background==9.2.9
9
- geode-common==33.8.8
10
- geode-conversion==6.3.3
11
- geode-explicit==6.2.3
12
- geode-implicit==3.9.4
13
- geode-numerics==6.2.2
14
- geode-simplex==9.4.2
15
- geode-viewables==3.1.4
16
- itsdangerous==2.2.0
17
- jinja2==3.1.6
18
- markupsafe==3.0.2
19
- opengeode-core==15.21.2
20
- opengeode-geosciences==9.0.0
21
- opengeode-geosciencesio==5.4.2
22
- opengeode-inspector==6.6.1
23
- opengeode-io==7.2.1
24
- referencing==0.36.2
25
- rpds-py==0.25.1
26
- typing-extensions==4.14.0
27
- werkzeug==3.1.3
@@ -1,93 +0,0 @@
1
- # Standard library imports
2
- import re
3
- import os
4
-
5
- # Third party imports
6
- import flask
7
-
8
- # Local application imports
9
- from src.opengeodeweb_back import geode_functions, utils_functions
10
-
11
-
12
- def test_increment_request_counter(app_context):
13
- assert flask.current_app.config.get("REQUEST_COUNTER") == 0
14
- utils_functions.increment_request_counter(flask.current_app)
15
- assert flask.current_app.config.get("REQUEST_COUNTER") == 1
16
-
17
-
18
- def test_decrement_request_counter(app_context):
19
- assert flask.current_app.config.get("REQUEST_COUNTER") == 1
20
- utils_functions.decrement_request_counter(flask.current_app)
21
- assert flask.current_app.config.get("REQUEST_COUNTER") == 0
22
-
23
-
24
- def test_update_last_request_time(app_context):
25
- LAST_REQUEST_TIME = flask.current_app.config.get("LAST_REQUEST_TIME")
26
- utils_functions.update_last_request_time(flask.current_app)
27
- assert flask.current_app.config.get("LAST_REQUEST_TIME") >= LAST_REQUEST_TIME
28
-
29
-
30
- def test_before_request(app_context):
31
- assert flask.current_app.config.get("REQUEST_COUNTER") == 0
32
- utils_functions.before_request(flask.current_app)
33
- assert flask.current_app.config.get("REQUEST_COUNTER") == 1
34
-
35
-
36
- def test_teardown_request(app_context):
37
- LAST_REQUEST_TIME = flask.current_app.config.get("LAST_REQUEST_TIME")
38
- assert flask.current_app.config.get("REQUEST_COUNTER") == 1
39
- utils_functions.teardown_request(flask.current_app)
40
- assert flask.current_app.config.get("REQUEST_COUNTER") == 0
41
- assert flask.current_app.config.get("LAST_REQUEST_TIME") >= LAST_REQUEST_TIME
42
-
43
-
44
- def test_versions():
45
- list_packages = [
46
- "OpenGeode-core",
47
- "OpenGeode-IO",
48
- "OpenGeode-Geosciences",
49
- "OpenGeode-GeosciencesIO",
50
- ]
51
- versions = utils_functions.versions(list_packages)
52
- assert type(versions) is list
53
- for version in versions:
54
- assert type(version) is dict
55
-
56
-
57
- def test_extension_from_filename():
58
- extension = utils_functions.extension_from_filename("test.toto")
59
- assert type(extension) is str
60
- assert extension.count(".") == 0
61
-
62
-
63
- def test_handle_exception(client):
64
- route = "/error"
65
- response = client.post(route)
66
- assert response.status_code == 500
67
- data = response.get_json()
68
- assert type(data) is dict
69
- assert type(data["description"]) is str
70
- assert type(data["name"]) is str
71
- assert type(data["code"]) is int
72
-
73
-
74
- def test_generate_native_viewable_and_light_viewable(client):
75
- app = client.application
76
- with app.app_context():
77
- geode_object = "BRep"
78
- data = geode_functions.load(geode_object, "./tests/data/test.og_brep")
79
-
80
- result = utils_functions.generate_native_viewable_and_light_viewable(
81
- geode_object, data
82
- )
83
-
84
- assert type(result) is dict
85
- assert type(result["name"]) is str
86
- assert type(result["native_file_name"]) is str
87
- assert result["native_file_name"] == "native.og_brep"
88
- assert type(result["viewable_file_name"]) is str
89
- assert result["viewable_file_name"] == "viewable.vtm"
90
- assert type(result["id"]) is str
91
- assert re.match(r"[0-9a-f]{32}", result["id"])
92
- assert type(result["object_type"]) is str
93
- assert type(result["binary_light_viewable"]) is str