Skip to content

Commit

Permalink
[Server][Feature][needs-docs] Testing that exceptions are not cached
Browse files Browse the repository at this point in the history
  • Loading branch information
rldhont committed Aug 24, 2018
1 parent 6cb9997 commit 3626cf1
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/src/python/test_qgsserver_cachemanager.py
Expand Up @@ -390,6 +390,31 @@ def test_gettile(self):
filelist = [f for f in os.listdir(self._servercache._tile_cache_dir) if f.endswith(".png")]
self.assertEqual(len(filelist), 0, 'All images in cache are not deleted ')

def test_gettile_invalid_parameters(self):
project = self._project_path
assert os.path.exists(project), "Project file not found: " + project

qs = "?" + "&".join(["%s=%s" % i for i in list({
"MAP": urllib.parse.quote(project),
"SERVICE": "WMTS",
"VERSION": "1.0.0",
"REQUEST": "GetTile",
"LAYER": "Country",
"STYLE": "",
"TILEMATRIXSET": "EPSG:3857",
"TILEMATRIX": "0",
"TILEROW": "0",
"TILECOL": "FOO",
"FORMAT": "image/png"
}.items())])

r, h = self._result(self._execute_request(qs))
err = b"TILECOL (\'FOO\') cannot be converted into int" in r
self.assertTrue(err)

filelist = [f for f in os.listdir(self._servercache._tile_cache_dir) if f.endswith(".png")]
self.assertEqual(len(filelist), 0, 'Exception has been cached ')


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

0 comments on commit 3626cf1

Please sign in to comment.