Skip to content

Commit

Permalink
Fix thumbs backgrounds tests
Browse files Browse the repository at this point in the history
  • Loading branch information
giohappy committed Oct 18, 2023
1 parent e06298f commit 07759cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions geonode/thumbs/background.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,8 +542,8 @@ def fetch(self, bbox: typing.List, *args, **kwargs):
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")
Expand Down
6 changes: 3 additions & 3 deletions geonode/thumbs/tests/test_backgrounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
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",
Expand Down Expand Up @@ -345,8 +345,8 @@ def test_get_tiles_coords(self, *args):
@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)
Expand Down

0 comments on commit 07759cc

Please sign in to comment.