c2cgeoportal-admin 2.8.1.181__py3-none-any.whl → 2.9rc2__py3-none-any.whl
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.
- c2cgeoportal_admin/__init__.py +14 -6
- c2cgeoportal_admin/lib/{lingua_extractor.py → lingva_extractor.py} +6 -6
- c2cgeoportal_admin/lib/ogcserver_synchronizer.py +6 -5
- c2cgeoportal_admin/routes.py +12 -3
- c2cgeoportal_admin/schemas/dimensions.py +4 -2
- c2cgeoportal_admin/schemas/functionalities.py +9 -12
- c2cgeoportal_admin/schemas/interfaces.py +7 -3
- c2cgeoportal_admin/schemas/metadata.py +13 -13
- c2cgeoportal_admin/schemas/restriction_areas.py +5 -3
- c2cgeoportal_admin/schemas/roles.py +7 -3
- c2cgeoportal_admin/schemas/treegroup.py +14 -10
- c2cgeoportal_admin/schemas/treeitem.py +2 -2
- c2cgeoportal_admin/static/theme.css +3 -0
- c2cgeoportal_admin/views/dimension_layers.py +11 -7
- c2cgeoportal_admin/views/functionalities.py +25 -18
- c2cgeoportal_admin/views/interfaces.py +22 -15
- c2cgeoportal_admin/views/layer_groups.py +33 -20
- c2cgeoportal_admin/views/layers.py +12 -9
- c2cgeoportal_admin/views/layers_cog.py +135 -0
- c2cgeoportal_admin/views/layers_vectortiles.py +42 -27
- c2cgeoportal_admin/views/layers_wms.py +47 -32
- c2cgeoportal_admin/views/layers_wmts.py +46 -32
- c2cgeoportal_admin/views/layertree.py +9 -8
- c2cgeoportal_admin/views/logged_views.py +15 -12
- c2cgeoportal_admin/views/logs.py +9 -8
- c2cgeoportal_admin/views/oauth2_clients.py +26 -22
- c2cgeoportal_admin/views/ogc_servers.py +48 -34
- c2cgeoportal_admin/views/restriction_areas.py +29 -19
- c2cgeoportal_admin/views/roles.py +29 -19
- c2cgeoportal_admin/views/themes.py +35 -24
- c2cgeoportal_admin/views/themes_ordering.py +11 -11
- c2cgeoportal_admin/views/treeitems.py +13 -11
- c2cgeoportal_admin/views/users.py +37 -22
- c2cgeoportal_admin/widgets.py +3 -3
- {c2cgeoportal_admin-2.8.1.181.dist-info → c2cgeoportal_admin-2.9rc2.dist-info}/METADATA +3 -12
- {c2cgeoportal_admin-2.8.1.181.dist-info → c2cgeoportal_admin-2.9rc2.dist-info}/RECORD +48 -46
- {c2cgeoportal_admin-2.8.1.181.dist-info → c2cgeoportal_admin-2.9rc2.dist-info}/WHEEL +1 -1
- c2cgeoportal_admin-2.9rc2.dist-info/entry_points.txt +5 -0
- tests/__init__.py +13 -8
- tests/conftest.py +20 -10
- tests/test_layers_cog.py +243 -0
- tests/test_layers_vectortiles.py +2 -7
- tests/{test_lingua_extractor_config.py → test_lingva_extractor_config.py} +3 -3
- tests/test_logs.py +3 -4
- tests/test_oauth2_clients.py +3 -2
- tests/test_role.py +3 -2
- tests/test_user.py +8 -2
- c2cgeoportal_admin-2.8.1.181.dist-info/entry_points.txt +0 -6
- {c2cgeoportal_admin-2.8.1.181.dist-info → c2cgeoportal_admin-2.9rc2.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2017-
|
1
|
+
# Copyright (c) 2017-2024, Camptocamp SA
|
2
2
|
# All rights reserved.
|
3
3
|
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
@@ -26,10 +26,18 @@
|
|
26
26
|
# either expressed or implied, of the FreeBSD Project.
|
27
27
|
|
28
28
|
|
29
|
+
import os
|
29
30
|
from functools import partial
|
30
31
|
|
31
32
|
from c2cgeoform.schema import GeoFormSchemaNode
|
32
|
-
from c2cgeoform.views.abstract_views import
|
33
|
+
from c2cgeoform.views.abstract_views import (
|
34
|
+
DeleteResponse,
|
35
|
+
GridResponse,
|
36
|
+
IndexResponse,
|
37
|
+
ListField,
|
38
|
+
ObjectResponse,
|
39
|
+
SaveResponse,
|
40
|
+
)
|
33
41
|
from deform.widget import FormWidget
|
34
42
|
from passwordgenerator import pwgenerator
|
35
43
|
from pyramid.httpexceptions import HTTPFound
|
@@ -50,18 +58,23 @@ base_schema.add_unique_validator(User.username, User.id)
|
|
50
58
|
|
51
59
|
settings_role = aliased(Role)
|
52
60
|
|
61
|
+
_OPENID_CONNECT_ENABLED = os.environ.get("OPENID_CONNECT_ENABLED", "false").lower() in ("true", "yes", "1")
|
62
|
+
|
53
63
|
|
54
64
|
@view_defaults(match_param="table=users")
|
55
|
-
class UserViews(LoggedViews):
|
65
|
+
class UserViews(LoggedViews[User]):
|
56
66
|
"""The admin user view."""
|
57
67
|
|
58
68
|
_list_fields = [
|
59
69
|
_list_field("id"),
|
60
|
-
_list_field("username"),
|
70
|
+
*([_list_field("username")] if not _OPENID_CONNECT_ENABLED else []),
|
71
|
+
_list_field("display_name"),
|
61
72
|
_list_field("email"),
|
62
|
-
|
63
|
-
|
64
|
-
|
73
|
+
*(
|
74
|
+
[_list_field("last_login"), _list_field("expire_on"), _list_field("deactivated")]
|
75
|
+
if not _OPENID_CONNECT_ENABLED
|
76
|
+
else []
|
77
|
+
),
|
65
78
|
_list_field(
|
66
79
|
"settings_role",
|
67
80
|
renderer=lambda user: user.settings_role.name if user.settings_role else "",
|
@@ -85,25 +98,25 @@ class UserViews(LoggedViews):
|
|
85
98
|
self._request.dbsession.query(User)
|
86
99
|
.distinct()
|
87
100
|
.outerjoin(settings_role, settings_role.id == User.settings_role_id)
|
88
|
-
.outerjoin(
|
89
|
-
.options(subqueryload(
|
90
|
-
.options(subqueryload(
|
101
|
+
.outerjoin(User.roles)
|
102
|
+
.options(subqueryload(User.settings_role))
|
103
|
+
.options(subqueryload(User.roles))
|
91
104
|
)
|
92
105
|
|
93
|
-
@view_config(route_name="c2cgeoform_index", renderer="../templates/index.jinja2")
|
94
|
-
def index(self):
|
106
|
+
@view_config(route_name="c2cgeoform_index", renderer="../templates/index.jinja2") # type: ignore[misc]
|
107
|
+
def index(self) -> IndexResponse:
|
95
108
|
return super().index()
|
96
109
|
|
97
|
-
@view_config(route_name="c2cgeoform_grid", renderer="fast_json")
|
98
|
-
def grid(self):
|
110
|
+
@view_config(route_name="c2cgeoform_grid", renderer="fast_json") # type: ignore[misc]
|
111
|
+
def grid(self) -> GridResponse:
|
99
112
|
return super().grid()
|
100
113
|
|
101
|
-
@view_config(route_name="c2cgeoform_item", request_method="GET", renderer="../templates/edit.jinja2")
|
102
|
-
def view(self):
|
114
|
+
@view_config(route_name="c2cgeoform_item", request_method="GET", renderer="../templates/edit.jinja2") # type: ignore[misc]
|
115
|
+
def view(self) -> ObjectResponse:
|
103
116
|
return super().edit()
|
104
117
|
|
105
|
-
@view_config(route_name="c2cgeoform_item", request_method="POST", renderer="../templates/edit.jinja2")
|
106
|
-
def save(self):
|
118
|
+
@view_config(route_name="c2cgeoform_item", request_method="POST", renderer="../templates/edit.jinja2") # type: ignore[misc]
|
119
|
+
def save(self) -> SaveResponse:
|
107
120
|
if self._is_new():
|
108
121
|
response = super().save()
|
109
122
|
|
@@ -111,9 +124,11 @@ class UserViews(LoggedViews):
|
|
111
124
|
password = pwgenerator.generate()
|
112
125
|
|
113
126
|
user = self._obj
|
127
|
+
assert user is not None
|
114
128
|
user.password = password
|
115
129
|
user.is_password_changed = False
|
116
130
|
user = self._request.dbsession.merge(user)
|
131
|
+
assert user is not None
|
117
132
|
self._request.dbsession.flush()
|
118
133
|
|
119
134
|
send_email_config(
|
@@ -130,12 +145,12 @@ class UserViews(LoggedViews):
|
|
130
145
|
|
131
146
|
return super().save()
|
132
147
|
|
133
|
-
@view_config(route_name="c2cgeoform_item", request_method="DELETE", renderer="fast_json")
|
134
|
-
def delete(self):
|
148
|
+
@view_config(route_name="c2cgeoform_item", request_method="DELETE", renderer="fast_json") # type: ignore[misc]
|
149
|
+
def delete(self) -> DeleteResponse:
|
135
150
|
return super().delete()
|
136
151
|
|
137
|
-
@view_config(
|
152
|
+
@view_config( # type: ignore[misc]
|
138
153
|
route_name="c2cgeoform_item_duplicate", request_method="GET", renderer="../templates/edit.jinja2"
|
139
154
|
)
|
140
|
-
def duplicate(self):
|
155
|
+
def duplicate(self) -> ObjectResponse:
|
141
156
|
return super().duplicate()
|
c2cgeoportal_admin/widgets.py
CHANGED
@@ -25,7 +25,7 @@
|
|
25
25
|
# of the authors and should not be interpreted as representing official policies,
|
26
26
|
# either expressed or implied, of the FreeBSD Project.
|
27
27
|
|
28
|
-
from typing import Any
|
28
|
+
from typing import Any
|
29
29
|
|
30
30
|
import colander
|
31
31
|
import pyramid.request
|
@@ -90,13 +90,13 @@ class ChildWidget(MappingWidget): # type: ignore
|
|
90
90
|
model = TreeItem
|
91
91
|
label_field = "name"
|
92
92
|
|
93
|
-
def icon_class(self, child: Any) ->
|
93
|
+
def icon_class(self, child: Any) -> str | None: # pylint: disable=useless-return
|
94
94
|
del child
|
95
95
|
return None
|
96
96
|
|
97
97
|
def edit_url( # pylint: disable=useless-return
|
98
98
|
self, request: pyramid.request.Request, child: Any
|
99
|
-
) ->
|
99
|
+
) -> str | None:
|
100
100
|
del request
|
101
101
|
del child
|
102
102
|
return None
|
@@ -1,13 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: c2cgeoportal-admin
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.9rc2
|
4
4
|
Summary: c2cgeoportal admin
|
5
5
|
Home-page: https://github.com/camptocamp/c2cgeoportal/
|
6
6
|
Author: Camptocamp
|
7
7
|
Author-email: info@camptocamp.com
|
8
|
-
License: UNKNOWN
|
9
8
|
Keywords: web gis geoportail c2cgeoportal geocommune pyramid
|
10
|
-
Platform: UNKNOWN
|
11
9
|
Classifier: Development Status :: 6 - Mature
|
12
10
|
Classifier: Environment :: Web Environment
|
13
11
|
Classifier: Framework :: Pyramid
|
@@ -16,28 +14,23 @@ Classifier: License :: OSI Approved :: BSD License
|
|
16
14
|
Classifier: Operating System :: OS Independent
|
17
15
|
Classifier: Programming Language :: Python
|
18
16
|
Classifier: Programming Language :: Python :: 3
|
19
|
-
Classifier: Programming Language :: Python :: 3.
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
20
18
|
Classifier: Topic :: Scientific/Engineering :: GIS
|
21
19
|
Classifier: Typing :: Typed
|
20
|
+
Requires-Python: >=3.10
|
22
21
|
Description-Content-Type: text/markdown
|
23
|
-
Requires-Dist: babel (>=2.9.1)
|
24
22
|
Requires-Dist: c2cgeoform
|
25
23
|
Requires-Dist: c2cwsgiutils
|
26
|
-
Requires-Dist: certifi (>=2022.12.7)
|
27
24
|
Requires-Dist: colander
|
28
25
|
Requires-Dist: deform
|
29
|
-
Requires-Dist: idna (>=3.7)
|
30
26
|
Requires-Dist: passwordgenerator
|
31
|
-
Requires-Dist: pygments (>=2.15.0)
|
32
27
|
Requires-Dist: pyproj
|
33
28
|
Requires-Dist: pyramid
|
34
29
|
Requires-Dist: pyramid-debugtoolbar
|
35
30
|
Requires-Dist: pyramid-jinja2
|
36
31
|
Requires-Dist: pyramid-tm
|
37
|
-
Requires-Dist: requests (>=2.32.0)
|
38
32
|
Requires-Dist: sqlalchemy
|
39
33
|
Requires-Dist: translationstring
|
40
|
-
Requires-Dist: urllib3 (>=1.26.17)
|
41
34
|
Requires-Dist: zope.event
|
42
35
|
|
43
36
|
# c2cgeoportal admin interface
|
@@ -52,5 +45,3 @@ make serve
|
|
52
45
|
```
|
53
46
|
|
54
47
|
Now open http://localhost:8888/admin/ in your favorite browser.
|
55
|
-
|
56
|
-
|
@@ -1,23 +1,23 @@
|
|
1
|
-
c2cgeoportal_admin/__init__.py,sha256=
|
1
|
+
c2cgeoportal_admin/__init__.py,sha256=HVSQ-CwK5aR9URA-NVH7JlYHGU49xT5vARiTkdxpV70,5767
|
2
2
|
c2cgeoportal_admin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
c2cgeoportal_admin/routes.py,sha256=
|
3
|
+
c2cgeoportal_admin/routes.py,sha256=oja-Seyn08geema9lKJEVU-bPzuT8RaNBfUORDxEm6w,5302
|
4
4
|
c2cgeoportal_admin/subscribers.py,sha256=P1CaccDTpuxrWak_gMN2qBurz3OrAZ6aZ1LA7P3avu8,2430
|
5
|
-
c2cgeoportal_admin/widgets.py,sha256=
|
5
|
+
c2cgeoportal_admin/widgets.py,sha256=8bozaTGBZKxDIMWbkHU1eD0MmOQ9KMOn21PDLYbQGFs,6092
|
6
6
|
c2cgeoportal_admin/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
-
c2cgeoportal_admin/lib/
|
8
|
-
c2cgeoportal_admin/lib/ogcserver_synchronizer.py,sha256=
|
7
|
+
c2cgeoportal_admin/lib/lingva_extractor.py,sha256=5XsUHeVHnGF6GmD83shaTXasigGXtDXwgnswU0xA410,3355
|
8
|
+
c2cgeoportal_admin/lib/ogcserver_synchronizer.py,sha256=AFr0TbI_l7QTf9oNyO6rFEy6Ix096R2V0EFYcw-ArIc,15536
|
9
9
|
c2cgeoportal_admin/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
c2cgeoportal_admin/schemas/dimensions.py,sha256=
|
11
|
-
c2cgeoportal_admin/schemas/functionalities.py,sha256=
|
12
|
-
c2cgeoportal_admin/schemas/interfaces.py,sha256=
|
13
|
-
c2cgeoportal_admin/schemas/metadata.py,sha256=
|
14
|
-
c2cgeoportal_admin/schemas/restriction_areas.py,sha256=
|
15
|
-
c2cgeoportal_admin/schemas/roles.py,sha256=
|
16
|
-
c2cgeoportal_admin/schemas/treegroup.py,sha256=
|
17
|
-
c2cgeoportal_admin/schemas/treeitem.py,sha256=
|
10
|
+
c2cgeoportal_admin/schemas/dimensions.py,sha256=zpynF2qMISalyPihl0ZWsRFJBYwSUsbeGLQZjxURW1k,2319
|
11
|
+
c2cgeoportal_admin/schemas/functionalities.py,sha256=JecG1DYagM_Bgd7sMj0clN-4CAuYZEdELwDXlLRLBZs,3852
|
12
|
+
c2cgeoportal_admin/schemas/interfaces.py,sha256=N_b1LQ0Ur2i09dprnLLqXrcEq1p7uaKZJhaQpW7mOKc,2662
|
13
|
+
c2cgeoportal_admin/schemas/metadata.py,sha256=cp-QJkUf0zH0s6rBgV3uIZuXhHVFG5E8mF4J1ty2c6c,8897
|
14
|
+
c2cgeoportal_admin/schemas/restriction_areas.py,sha256=3zB_Uq9CshCKz99K4cnmit6gtqzuunCJc7vHTuwiUK8,2633
|
15
|
+
c2cgeoportal_admin/schemas/roles.py,sha256=YyRaStlu1IJwB5gRHlvS285twSy2xxatNOqV9klq1s8,2591
|
16
|
+
c2cgeoportal_admin/schemas/treegroup.py,sha256=pLBIGBeaCmsAUMC4yCFCdSkYqLytG38qVygYqNr_AX8,7150
|
17
|
+
c2cgeoportal_admin/schemas/treeitem.py,sha256=VhGhpG8VcsT-3dnnNlln-uVlsqjwJQXbg6Ap1tEanMI,2146
|
18
18
|
c2cgeoportal_admin/static/layertree.css,sha256=tk54KGW0yRRmdrY35gOCZG3qTsqWtGNEwvBYPQKhaVs,3177
|
19
19
|
c2cgeoportal_admin/static/navbar.css,sha256=QIaAQsb4n17OfwdKEQdmNDVPCP23Yu-oGW4xsSaHyW0,2307
|
20
|
-
c2cgeoportal_admin/static/theme.css,sha256=
|
20
|
+
c2cgeoportal_admin/static/theme.css,sha256=3knC4gpPnEwLF0-jEJze15C1hm1K87aCpxGyqdjrLxw,2068
|
21
21
|
c2cgeoportal_admin/templates/404.jinja2,sha256=KSpqCNFwv37rKSmX6kL_VvCnn5egcT1eRD6kIKwWx34,1807
|
22
22
|
c2cgeoportal_admin/templates/edit.jinja2,sha256=rkBQiz0JZdL7VDq8XrhRLTv6JaiFt_QB8CwP3NMHWQY,1302
|
23
23
|
c2cgeoportal_admin/templates/home.jinja2,sha256=WDQwmBGMZxsiOLw9YeYPLuca_mjjntjrTh529euzd1o,1516
|
@@ -42,54 +42,56 @@ c2cgeoportal_admin/templates/widgets/role_fields.pt,sha256=gVd9eRYaqw8fGmZauqEUS
|
|
42
42
|
c2cgeoportal_admin/templates/widgets/theme_fields.pt,sha256=68G1Ya8-Dc6pCeP-taQ0ofCIpnY_v0rouazkFhfQflU,3083
|
43
43
|
c2cgeoportal_admin/templates/widgets/user_fields.pt,sha256=twmajhUYL1xa47Eu-iATKifNPA5lu3SGpqdKajH6gL8,1753
|
44
44
|
c2cgeoportal_admin/views/__init__.py,sha256=jtI6CdoXJwizznjwb8ClYySgq4kbwhTIJYutSw89PAw,683
|
45
|
-
c2cgeoportal_admin/views/dimension_layers.py,sha256=
|
46
|
-
c2cgeoportal_admin/views/functionalities.py,sha256=
|
45
|
+
c2cgeoportal_admin/views/dimension_layers.py,sha256=WL3CqfAY8mref9cen1lCF5vADg_csf2Pp5zeEYX1ZXg,2778
|
46
|
+
c2cgeoportal_admin/views/functionalities.py,sha256=F51rdqVqbdWx1iNz8DHauhh3B8f6x6lEidaskxBn1so,4379
|
47
47
|
c2cgeoportal_admin/views/home.py,sha256=h_hJWIKpzJeSmXl58J0nvZdEg7avSYOOVUEEnlV-r0k,1943
|
48
|
-
c2cgeoportal_admin/views/interfaces.py,sha256=
|
49
|
-
c2cgeoportal_admin/views/layer_groups.py,sha256=
|
50
|
-
c2cgeoportal_admin/views/layers.py,sha256=
|
51
|
-
c2cgeoportal_admin/views/
|
52
|
-
c2cgeoportal_admin/views/
|
53
|
-
c2cgeoportal_admin/views/
|
54
|
-
c2cgeoportal_admin/views/
|
55
|
-
c2cgeoportal_admin/views/
|
56
|
-
c2cgeoportal_admin/views/
|
57
|
-
c2cgeoportal_admin/views/
|
58
|
-
c2cgeoportal_admin/views/
|
59
|
-
c2cgeoportal_admin/views/
|
60
|
-
c2cgeoportal_admin/views/
|
61
|
-
c2cgeoportal_admin/views/
|
62
|
-
c2cgeoportal_admin/views/
|
63
|
-
c2cgeoportal_admin/views/
|
64
|
-
c2cgeoportal_admin/views/
|
65
|
-
|
66
|
-
tests/
|
48
|
+
c2cgeoportal_admin/views/interfaces.py,sha256=psp5dw22rI3enY9AS0aIspHBdv-sVzSPBQKGIhW3-Hw,3844
|
49
|
+
c2cgeoportal_admin/views/layer_groups.py,sha256=xQiEkO7LuNy0FiwfHZa1XwaoMvr9UE2bLpckOtdyuMM,4489
|
50
|
+
c2cgeoportal_admin/views/layers.py,sha256=JDEO8hEIPhRxZVpxyT_0FU6gWCgREllw5O9qBCCxipU,3248
|
51
|
+
c2cgeoportal_admin/views/layers_cog.py,sha256=tFljZufefGP8YZvidAhUA5cgwbO1R2D7wXdQdS1EX1I,5627
|
52
|
+
c2cgeoportal_admin/views/layers_vectortiles.py,sha256=fTNaGGt7ZIX9wydZvED6mp1B8iBtt-qbywv2MqQgV_Q,5617
|
53
|
+
c2cgeoportal_admin/views/layers_wms.py,sha256=kjhH4TWnVnH81J__vcbyST2qEMSz3qHOxcEL8ELvLuU,8335
|
54
|
+
c2cgeoportal_admin/views/layers_wmts.py,sha256=Kb-j_yPEJycBYh5E-D-eP3xEhuzraotNL9bLup7GoNM,8080
|
55
|
+
c2cgeoportal_admin/views/layertree.py,sha256=sWDDTqiBIl9LyGvzChI0hnBSP_IqjTNcsJpq_pk52V8,8605
|
56
|
+
c2cgeoportal_admin/views/logged_views.py,sha256=Yg8HnrLCog4geNWOjkhF_Zo2ByOKuevdVT8xLd9x5Ow,3335
|
57
|
+
c2cgeoportal_admin/views/logs.py,sha256=N1I0gqzoqbEtkOsP0EhrlEWsDYuiuKQ46_YeKy7zFHs,3776
|
58
|
+
c2cgeoportal_admin/views/oauth2_clients.py,sha256=RC_vrMQaYGujN97wHihQXrO_0K7CrcFF1rSI0-dHZlg,3840
|
59
|
+
c2cgeoportal_admin/views/ogc_servers.py,sha256=kIhlZ7Sp_mdZUlyl2h4foTTgkevWrbZb_chLZUXEF1o,9716
|
60
|
+
c2cgeoportal_admin/views/restriction_areas.py,sha256=QQKDC7nUkNecC2knnnoLijhc2LvvjV8wZm3fcmRjftc,6122
|
61
|
+
c2cgeoportal_admin/views/roles.py,sha256=I6di90WR20EkFoy33milrHZ74_dgCkEVeNDM8E4P46w,6387
|
62
|
+
c2cgeoportal_admin/views/themes.py,sha256=6le9_3vhYa_ez0q52i--M24xPsycrGtpVKoCRhn7H0k,6267
|
63
|
+
c2cgeoportal_admin/views/themes_ordering.py,sha256=PgPaqKe7A5d2cYcDeJyoK615BNXayOmRcKNAAopvfRc,5689
|
64
|
+
c2cgeoportal_admin/views/treeitems.py,sha256=EgDArC5M39iihbB1Ok2VXmAAuH2DhhBrjeF0TbJgOQ4,4038
|
65
|
+
c2cgeoportal_admin/views/users.py,sha256=8zoSgSn0RFnu-Gc6gJr58T5ySsd0L2UQFZdSwfptdY8,6147
|
66
|
+
tests/__init__.py,sha256=weLUoRCG6zIlhW7Rfr7QEA0Ju-gYLfBekRcTCb5lTZ4,9785
|
67
|
+
tests/conftest.py,sha256=vowo5nwQ3DLSfost3ndihoYJFuhuhpoK__-B_ffsSLY,2646
|
67
68
|
tests/test_edit_url.py,sha256=Mo_Vo5xvdpPasfjvhQUif5F3nKVpJ6GQJ_x_Hj5VNY8,4494
|
68
69
|
tests/test_functionalities.py,sha256=tGQbEsQWjr_oExI3vWhLIioxylDaoUaOfEas42YPw50,5191
|
69
70
|
tests/test_home.py,sha256=oWsKaWqRicNpUdaca54YvLIBRaGYnsXlv_Tjqv7guEQ,425
|
70
71
|
tests/test_interface.py,sha256=z1jpRzW0R2e9BJWWurE-j-YkG5yhorn7h1XRIauUQ7A,5669
|
71
72
|
tests/test_layer_groups.py,sha256=bisbaDY0SiyBc0rexYajbcvfdDt8Kux6VqXIEBLSULM,12191
|
72
|
-
tests/
|
73
|
+
tests/test_layers_cog.py,sha256=5p7NHZw1IXfHg8Weqie3ibjDIJYVm7KAGGOiaZoBYO0,9848
|
74
|
+
tests/test_layers_vectortiles.py,sha256=uZGO-0-uVuvkPVMQI11tSY381tEmgWeYvlxKI19pslg,10158
|
73
75
|
tests/test_layers_wms.py,sha256=ynqO1cnXk2ZbSXR3l9hp0IyG8PMXbmR4eyubnwRvRfU,19494
|
74
76
|
tests/test_layers_wmts.py,sha256=7zye_pZ_e0RyJdoT8oeHKPoYJMKWfTg0K8lEgMIu77Q,12181
|
75
77
|
tests/test_layertree.py,sha256=Dxe10OwuilQ-AEgVIDU4Ns9U6PQ4kPWTxwItdBE7nSg,11335
|
76
78
|
tests/test_learn.py,sha256=gQwe-Bim0eihZH0rbBWDn6_rIBxvQD_lyu9MlOljupM,2307
|
77
79
|
tests/test_left_menu.py,sha256=xnlv5sD0k3wpCChKCnbpYRN0TA895pg8k6wVvjf99-4,919
|
78
|
-
tests/
|
79
|
-
tests/test_logs.py,sha256=
|
80
|
+
tests/test_lingva_extractor_config.py,sha256=ZQE8zBl91khK68MX0chL6mQPgfpIWQgMxlqFFpCwmSw,2495
|
81
|
+
tests/test_logs.py,sha256=pxzHyOElW-x2-M3yoMEsHIZ3nrm5EptDAAAGfziEfv4,3132
|
80
82
|
tests/test_main.py,sha256=_gUdMrMMAEzvGIf1QwkoHQkd0eBACz05ycTidCHP5Ao,365
|
81
83
|
tests/test_metadatas.py,sha256=bVNxvZRKNRMmjQGr7Al1d4H85EjEaoesRpxytyld4Fw,12088
|
82
|
-
tests/test_oauth2_clients.py,sha256
|
84
|
+
tests/test_oauth2_clients.py,sha256=5vyuCsba2WVgr6yMJysw73pAnXCZXhLO7dLIgV-spic,7028
|
83
85
|
tests/test_ogc_servers.py,sha256=DGSMVIzYnw3bJT53VFGuPYIPMPCyHJDb5ZPJj1VM3Bo,8204
|
84
86
|
tests/test_restriction_areas.py,sha256=5VhO9ZvtFQPy1kVFm96Mh_vf1LCI5oeIdl0dfvS6JD8,9003
|
85
|
-
tests/test_role.py,sha256=
|
87
|
+
tests/test_role.py,sha256=2mbi0RwTESnIZIuUTxMi275ONOcPNKWN-ni7b00SO90,12804
|
86
88
|
tests/test_themes.py,sha256=uhzHe2TbuNoLnL4VdYATPnOqtnZWWPKsvUTq6GUxwiU,16207
|
87
89
|
tests/test_themes_ordering.py,sha256=T4Esr0C3EN5UdeEyYLa4ePvEn-bx3RNPkGBK3lDFoBo,2243
|
88
90
|
tests/test_treegroup.py,sha256=Plv119G4TWlurWLE7Z1mWGeHHPScK_fWKcDmDzMUlIU,576
|
89
|
-
tests/test_user.py,sha256=
|
91
|
+
tests/test_user.py,sha256=5C9nrQVk4Bf0Z9BKd0uf_J8EtJLTOFSpzrNHXfg3NzI,13095
|
90
92
|
tests/themes_ordering.py,sha256=UdydcRIzWC6RRnTMfl2JM_250DHuAhGC7rijHqfy7lk,1342
|
91
|
-
c2cgeoportal_admin-2.
|
92
|
-
c2cgeoportal_admin-2.
|
93
|
-
c2cgeoportal_admin-2.
|
94
|
-
c2cgeoportal_admin-2.
|
95
|
-
c2cgeoportal_admin-2.
|
93
|
+
c2cgeoportal_admin-2.9rc2.dist-info/METADATA,sha256=eRPDi_v_H3ZI1AVK6Y3d5E3Bp2_J07Y4M3BfY2E9fbA,1381
|
94
|
+
c2cgeoportal_admin-2.9rc2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
95
|
+
c2cgeoportal_admin-2.9rc2.dist-info/entry_points.txt,sha256=iRK5w2E-PVbqHx48OuxznFEXTpoOdJyx6kjpaca0Fxc,164
|
96
|
+
c2cgeoportal_admin-2.9rc2.dist-info/top_level.txt,sha256=DgcTJgTvpJUB8HqwYB14PdLBPAOAFk0B8oqnSTFoAU4,25
|
97
|
+
c2cgeoportal_admin-2.9rc2.dist-info/RECORD,,
|
tests/__init__.py
CHANGED
@@ -9,13 +9,15 @@ skip_if_ci = pytest.mark.skipif(os.environ.get("CI", "false") == "true", reason=
|
|
9
9
|
|
10
10
|
|
11
11
|
def get_test_default_layers(dbsession, default_ogc_server):
|
12
|
-
from c2cgeoportal_commons.models.main import LayerVectorTiles, LayerWMS, LayerWMTS
|
13
|
-
|
14
|
-
default_wms =
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
from c2cgeoportal_commons.models.main import LayerCOG, LayerVectorTiles, LayerWMS, LayerWMTS
|
13
|
+
|
14
|
+
default_wms = None
|
15
|
+
if default_ogc_server:
|
16
|
+
default_wms = LayerWMS("wms-defaults")
|
17
|
+
default_wms.ogc_server = default_ogc_server
|
18
|
+
default_wms.time_widget = "datepicker"
|
19
|
+
default_wms.time_mode = "value"
|
20
|
+
dbsession.add(default_wms)
|
19
21
|
default_wmts = LayerWMTS("wmts-defaults")
|
20
22
|
default_wmts.url = "https:///wmts.geo.admin_default.ch.org?service=wms&request=GetCapabilities"
|
21
23
|
default_wmts.layer = "default"
|
@@ -24,8 +26,11 @@ def get_test_default_layers(dbsession, default_ogc_server):
|
|
24
26
|
default_vectortiles = LayerVectorTiles("vectortiles-defaults")
|
25
27
|
default_vectortiles.style = "https://vectortiles-staging.geoportail.lu/styles/roadmap/style.json"
|
26
28
|
dbsession.add(default_vectortiles)
|
29
|
+
default_cog = LayerCOG("cog-defaults")
|
30
|
+
default_cog.url = "https://example.com/image.tiff"
|
31
|
+
dbsession.add(default_cog)
|
27
32
|
dbsession.flush()
|
28
|
-
return {"wms": default_wms, "wmts": default_wmts, "vectortiles": default_vectortiles}
|
33
|
+
return {"wms": default_wms, "wmts": default_wmts, "vectortiles": default_vectortiles, "cog": default_cog}
|
29
34
|
|
30
35
|
|
31
36
|
def factory_build_layers(layer_builder, dbsession, add_dimension=True):
|
tests/conftest.py
CHANGED
@@ -1,8 +1,15 @@
|
|
1
|
+
from typing import Any
|
2
|
+
|
3
|
+
import pyramid.request
|
1
4
|
import pytest
|
5
|
+
import sqlalchemy.exc
|
2
6
|
import transaction
|
3
7
|
from pyramid import testing
|
4
8
|
from pyramid.paster import bootstrap
|
9
|
+
from pyramid.router import Router
|
10
|
+
from pyramid.scripting import AppEnvironment
|
5
11
|
from sqlalchemy.exc import DBAPIError
|
12
|
+
from sqlalchemy.orm import Session, SessionTransaction
|
6
13
|
from webtest import TestApp as WebTestApp # Avoid warning with pytest
|
7
14
|
|
8
15
|
from c2cgeoportal_commons.testing import generate_mappers, get_engine, get_session_factory, get_tm_session
|
@@ -11,31 +18,34 @@ from c2cgeoportal_commons.testing.initializedb import truncate_tables
|
|
11
18
|
|
12
19
|
@pytest.fixture(scope="session")
|
13
20
|
@pytest.mark.usefixtures("settings")
|
14
|
-
def dbsession(settings):
|
21
|
+
def dbsession(settings: dict[str, Any]) -> Session:
|
15
22
|
generate_mappers()
|
16
23
|
engine = get_engine(settings)
|
17
|
-
truncate_tables(engine)
|
18
24
|
session_factory = get_session_factory(engine)
|
19
25
|
session = get_tm_session(session_factory, transaction.manager)
|
26
|
+
truncate_tables(session)
|
20
27
|
yield session
|
21
28
|
|
22
29
|
|
23
30
|
@pytest.fixture(scope="function")
|
24
31
|
@pytest.mark.usefixtures("dbsession")
|
25
|
-
def transact(dbsession):
|
32
|
+
def transact(dbsession: Session) -> SessionTransaction:
|
26
33
|
t = dbsession.begin_nested()
|
27
34
|
yield t
|
28
|
-
|
35
|
+
try:
|
36
|
+
t.rollback()
|
37
|
+
except sqlalchemy.exc.ResourceClosedError:
|
38
|
+
print("The transaction was already closed")
|
29
39
|
dbsession.expire_all()
|
30
40
|
|
31
41
|
|
32
|
-
def raise_db_error(_):
|
42
|
+
def raise_db_error(_: Any) -> None:
|
33
43
|
raise DBAPIError("this is a test !", None, None)
|
34
44
|
|
35
45
|
|
36
46
|
@pytest.fixture(scope="function")
|
37
47
|
@pytest.mark.usefixtures("dbsession")
|
38
|
-
def raise_db_error_on_query(dbsession):
|
48
|
+
def raise_db_error_on_query(dbsession: Session) -> None:
|
39
49
|
query = dbsession.query
|
40
50
|
dbsession.query = raise_db_error
|
41
51
|
yield
|
@@ -43,7 +53,7 @@ def raise_db_error_on_query(dbsession):
|
|
43
53
|
|
44
54
|
|
45
55
|
@pytest.fixture(scope="session")
|
46
|
-
def app_env():
|
56
|
+
def app_env() -> AppEnvironment:
|
47
57
|
file_name = "/opt/c2cgeoportal/admin/tests/tests.ini"
|
48
58
|
with bootstrap(file_name) as env:
|
49
59
|
yield env
|
@@ -51,7 +61,7 @@ def app_env():
|
|
51
61
|
|
52
62
|
@pytest.fixture(scope="session")
|
53
63
|
@pytest.mark.usefixtures("app_env", "dbsession")
|
54
|
-
def app(app_env, dbsession):
|
64
|
+
def app(app_env: AppEnvironment, dbsession: Session) -> Router:
|
55
65
|
config = testing.setUp(registry=app_env["registry"])
|
56
66
|
config.add_request_method(lambda request: dbsession, "dbsession", reify=True)
|
57
67
|
config.add_route("user_add", "user_add")
|
@@ -64,12 +74,12 @@ def app(app_env, dbsession):
|
|
64
74
|
|
65
75
|
@pytest.fixture(scope="session")
|
66
76
|
@pytest.mark.usefixtures("app_env")
|
67
|
-
def settings(app_env):
|
77
|
+
def settings(app_env: AppEnvironment) -> Any:
|
68
78
|
yield app_env.get("registry").settings
|
69
79
|
|
70
80
|
|
71
81
|
@pytest.fixture(scope="session") # noqa: ignore=F811
|
72
82
|
@pytest.mark.usefixtures("app")
|
73
|
-
def test_app(request, app):
|
83
|
+
def test_app(request: pyramid.request.Request, app: Router) -> WebTestApp:
|
74
84
|
testapp = WebTestApp(app)
|
75
85
|
yield testapp
|