Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Sep 1, 2022
1 parent 3728040 commit 914ee57
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 32 deletions.
4 changes: 2 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ typed-ast = "==1.4.3"
typing = "==3.7.4.3"
typing-extensions = "==3.10.0.0"
unidecode = "==1.2.0"
urllib3 = "==1.25.9"
urllib3 = "==1.25.11"
waitress = "==2.1.1"
webob = "==1.8.6"
wrapt = "==1.11.2"
zipp = "==3.4.1"
responses = "*"
responses = "==0.21.0"

[packages]
alembic = "==1.4.2" # geoportal
Expand Down
8 changes: 4 additions & 4 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion geoportal/c2cgeoportal_geoportal/views/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ async def preload_ogc_server(
self, ogc_server: main.OGCServer, url_internal_wfs: str, cache: bool = True
) -> None:
if ogc_server.wfs_support:
await self._get_features_attributes(url_internal_wfs, ogc_server)
await self._get_features_attributes(url_internal_wfs, ogc_server, cache=cache)
await self._wms_getcap(ogc_server, False, cache=cache)

async def _get_features_attributes(
Expand Down
44 changes: 19 additions & 25 deletions geoportal/tests/functional/test_themes_ogc_server_cache_clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,13 @@ def test_ogc_server_cache_clean(self):
all_errors = set()
url_internal_wfs, _, _ = theme.get_url_internal_wfs(ogc_server, all_errors)

responses.add(
responses.GET,
"http://mapserver:8080/?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities&ROLE_IDS=0&USER_ID=0",
responses.get(
"http://mapserver:8080/?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities&ROLE_ID=0&USER_ID=0",
content_type="application/vnd.ogc.wms_xml",
body=CAP.format(name2="__test_layer_internal_wms2"),
)
responses.add(
responses.GET,
"http://mapserver:8080/?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&ROLE_IDS=0&USER_ID=0",
responses.get(
"http://mapserver:8080/?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&ROLE_ID=0&USER_ID=0",
content_type="application/vnd.ogc.wms_xml",
body=DFT.format(name2="police1"),
)
Expand All @@ -270,27 +268,24 @@ def test_ogc_server_cache_clean(self):

assert set(self.std_cache.keys()) == set()
assert set(caching.MEMORY_CACHE_DICT.keys()) == {
"c2cgeoportal_geoportal.lib.oauth2|_get_oauth_client_cache|10|60",
"c2cgeoportal_geoportal.lib.functionality|_get_role|anonymous",
"c2cgeoportal_geoportal.lib.functionality|_get_functionalities_type",
"c2cgeoportal_geoportal.lib|_get_intranet_networks",
}
assert set(self.ogc_cache.keys()) == {
"c2cgeoportal_geoportal.views.theme|_get_features_attributes_cache|http://mapserver:8080/?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&ROLE_IDS=0&USER_ID=0|__test_ogc_server",
"c2cgeoportal_geoportal.views.theme|_get_features_attributes_cache|http://mapserver:8080/|__test_ogc_server",
f"c2cgeoportal_geoportal.views.theme|build_web_map_service|{ogc_server.id}",
"c2cgeoportal_geoportal.views.theme|do_get_http_cached|http://mapserver:8080/?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&ROLE_IDS=0&USER_ID=0",
"c2cgeoportal_geoportal.views.theme|do_get_http_cached|http://mapserver:8080/?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities&ROLE_IDS=0&USER_ID=0",
"c2cgeoportal_geoportal.views.theme|do_get_http_cached|http://mapserver:8080/?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&ROLE_ID=0&USER_ID=0",
"c2cgeoportal_geoportal.views.theme|do_get_http_cached|http://mapserver:8080/?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities&ROLE_ID=0&USER_ID=0",
}

responses.add(
responses.GET,
"http://mapserver:8080/?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities&ROLE_IDS=0&USER_ID=0",
responses.get(
"http://mapserver:8080/?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities&ROLE_ID=0&USER_ID=0",
content_type="application/vnd.ogc.wms_xml",
body=CAP.format(name2="__test_layer_internal_wms3"),
)
responses.add(
responses.GET,
"http://mapserver:8080/?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&ROLE_IDS=0&USER_ID=0",
responses.get(
"http://mapserver:8080/?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&ROLE_ID=0&USER_ID=0",
content_type="application/vnd.ogc.wms_xml",
body=DFT.format(name2="police2"),
)
Expand All @@ -311,15 +306,14 @@ def test_ogc_server_cache_clean(self):
assert set(attributes.keys()) == {"hotel_label", "police2"}

assert set(self.std_cache.keys()) == set()
assert set(caching.MEMORY_CACHE_DICT.keys()) == {
"c2cgeoportal_geoportal.lib.oauth2|_get_oauth_client_cache|10|60",
"c2cgeoportal_geoportal.lib.functionality|_get_role|anonymous",
"c2cgeoportal_geoportal.lib.functionality|_get_functionalities_type",
"c2cgeoportal_geoportal.lib|_get_intranet_networks",
}
#assert set(caching.MEMORY_CACHE_DICT.keys()) == {
# "c2cgeoportal_geoportal.lib.functionality|_get_role|anonymous",
# "c2cgeoportal_geoportal.lib.functionality|_get_functionalities_type",
# "c2cgeoportal_geoportal.lib|_get_intranet_networks",
#}
assert set(self.ogc_cache.keys()) == {
"c2cgeoportal_geoportal.views.theme|_get_features_attributes_cache|http://mapserver:8080/?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&ROLE_IDS=0&USER_ID=0|__test_ogc_server",
"c2cgeoportal_geoportal.views.theme|_get_features_attributes_cache|http://mapserver:8080/?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&ROLE_ID=0&USER_ID=0|__test_ogc_server",
f"c2cgeoportal_geoportal.views.theme|build_web_map_service|{ogc_server.id}",
"c2cgeoportal_geoportal.views.theme|do_get_http_cached|http://mapserver:8080/?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&ROLE_IDS=0&USER_ID=0",
"c2cgeoportal_geoportal.views.theme|do_get_http_cached|http://mapserver:8080/?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities&ROLE_IDS=0&USER_ID=0",
"c2cgeoportal_geoportal.views.theme|do_get_http_cached|http://mapserver:8080/?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&ROLE_ID=0&USER_ID=0",
"c2cgeoportal_geoportal.views.theme|do_get_http_cached|http://mapserver:8080/?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities&ROLE_ID=0&USER_ID=0",
}

0 comments on commit 914ee57

Please sign in to comment.