Skip to content

Commit 3626cf1

Browse files
committed
[Server][Feature][needs-docs] Testing that exceptions are not cached
1 parent 6cb9997 commit 3626cf1

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/src/python/test_qgsserver_cachemanager.py

+25
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,31 @@ def test_gettile(self):
390390
filelist = [f for f in os.listdir(self._servercache._tile_cache_dir) if f.endswith(".png")]
391391
self.assertEqual(len(filelist), 0, 'All images in cache are not deleted ')
392392

393+
def test_gettile_invalid_parameters(self):
394+
project = self._project_path
395+
assert os.path.exists(project), "Project file not found: " + project
396+
397+
qs = "?" + "&".join(["%s=%s" % i for i in list({
398+
"MAP": urllib.parse.quote(project),
399+
"SERVICE": "WMTS",
400+
"VERSION": "1.0.0",
401+
"REQUEST": "GetTile",
402+
"LAYER": "Country",
403+
"STYLE": "",
404+
"TILEMATRIXSET": "EPSG:3857",
405+
"TILEMATRIX": "0",
406+
"TILEROW": "0",
407+
"TILECOL": "FOO",
408+
"FORMAT": "image/png"
409+
}.items())])
410+
411+
r, h = self._result(self._execute_request(qs))
412+
err = b"TILECOL (\'FOO\') cannot be converted into int" in r
413+
self.assertTrue(err)
414+
415+
filelist = [f for f in os.listdir(self._servercache._tile_cache_dir) if f.endswith(".png")]
416+
self.assertEqual(len(filelist), 0, 'Exception has been cached ')
417+
393418

394419
if __name__ == "__main__":
395420
unittest.main()

0 commit comments

Comments
 (0)