Skip to content

Commit

Permalink
Add getmap with error on filter
Browse files Browse the repository at this point in the history
  • Loading branch information
troopa81 committed Feb 21, 2019
1 parent 053ab49 commit a2bc1ff
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/src/python/test_qgsserver_wms_getmap.py
Expand Up @@ -817,6 +817,28 @@ def test_wms_getmap_filter(self):
r, h = self._result(self._execute_request(qs))
self._img_diff_error(r, h, "WMS_GetMap_Filter5")

# Error in filter (missing quote after africa) with multiple layer filter
qs = "?" + "&".join(["%s=%s" % i for i in list({
"MAP": urllib.parse.quote(self.projectPath),
"SERVICE": "WMS",
"VERSION": "1.1.1",
"REQUEST": "GetMap",
"LAYERS": "Country,Country_Diagrams,Hello",
"STYLES": "",
"FORMAT": "image/png",
"BBOX": "1017529,-4226661,11271098,17063190",
"HEIGHT": "500",
"WIDTH": "500",
"CRS": "EPSG:3857",
"FILTER": "Country,Country_Diagrams: \"name\" IN ( 'africa , 'eurasia' );Hello: \"color\" IN ( 'magenta' , 'cerese' )"
}.items())])

expected = self.strip_version_xmlns(b'<ServiceExceptionReport >\n <ServiceException code="Filter string rejected">The filter string "name" IN ( \'africa , \'eurasia\' ) has been rejected because of security reasons. Note: Text strings have to be enclosed in single or double quotes. A space between each word / special character is mandatory. Allowed Keywords and special characters are AND,OR,IN,&lt;,>=,>,>=,!=,\',\',(,),DMETAPHONE,SOUNDEX. Not allowed are semicolons in the filter expression.</ServiceException>\n</ServiceExceptionReport>\n')
r, h = self._result(self._execute_request(qs))

self.assertEqual(self.strip_version_xmlns(r), expected)


def test_wms_getmap_filter_ogc(self):
filter = "<Filter><PropertyIsEqualTo><PropertyName>name</PropertyName>" + \
"<Literal>eurasia</Literal></PropertyIsEqualTo></Filter>"
Expand Down

0 comments on commit a2bc1ff

Please sign in to comment.