Skip to content
Snippets Groups Projects
Unverified Commit 9d6a4ca0 authored by Giovanni Allegri's avatar Giovanni Allegri Committed by GitHub
Browse files

[Fixes #11610] Make thumbs backgrounds tests run (#11611)

* make thumbs bagrounds run

* Fix thumbs backgrounds tests
parent 9ca2f13a
Branches
No related tags found
No related merge requests found
......@@ -542,8 +542,8 @@ class GenericWMTSBackground(BaseThumbBackground):
return background
def build_kvp_request(self, baseurl, layer, style, xyz):
return f"{baseurl}?&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer={layer}&style={style} \
&tilematrixset={self.options['tilematrixset']}&TileMatrix={xyz[2]}&TileRow={xyz[1]}&TileCol={xyz[0]}"
return f"{baseurl}?&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer={layer}&style={style}\
&tilematrixset={self.options['tilematrixset']}&TileMatrix={xyz[2]}&TileRow={xyz[1]}&TileCol={xyz[0]}"
def build_request(self, xyz):
request_encoding = self.options.get("requestencoding", "KVP")
......
......@@ -19,3 +19,4 @@
from .test_unit import * # noqa: F401, F403
from .test_integration import * # noqa: F401, F403
from .test_backgrounds import * # noqa: F401, F403
......@@ -276,7 +276,7 @@ WMTS_TILEMATRIX_LEVELS = [
THUMBNAIL_BACKGROUND = {
"class": "geonode.thumbs.background.GenericWMTSBackground",
"options": {
"url": "myserver.com/WMTS",
"url": "https://myserver.com/WMTS",
"layer": "Hosted_basemap_inforac_3857",
"style": "default",
"tilematrixset": "default028mm",
......@@ -345,8 +345,8 @@ class GeoNodeThumbnailWMTSBackground(GeoNodeBaseTestSupport):
@override_settings(THUMBNAIL_BACKGROUND=THUMBNAIL_BACKGROUND)
@patch("geonode.thumbs.background.WMTS_TILEMATRIXSET_LEVELS", WMTS_TILEMATRIX_LEVELS)
def test_build_request(self, *args):
expected_imgurl = "https://myserver.com/WMTS?&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png& \
layer=Hosted_basemap_inforac_3857&style=default&tilematrixset=default028mm&TileMatrix=4&TileRow=5&TileCol=7"
expected_imgurl = "https://myserver.com/WMTS?&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&\
layer=Hosted_basemap_inforac_3857&style=default&tilematrixset=default028mm&TileMatrix=4&TileRow=5&TileCol=7"
background = GenericWMTSBackground(thumbnail_width=500, thumbnail_height=200)
imgurl = background.build_request((7, 5, 4))
self.assertEqual(expected_imgurl, imgurl)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment