Skip to content

Commit

Permalink
Merge pull request #4505 from boundlessgeo/server-more-filter-tests
Browse files Browse the repository at this point in the history
[server] More WMS tests for FILTER parameter with bool operators and …
  • Loading branch information
elpaso committed May 5, 2017
2 parents 2185d42 + a5d61a5 commit 8fd4fc6
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/src/python/test_qgsserver.py
Expand Up @@ -224,6 +224,26 @@ def test_project_wms(self):
'FEATURE_COUNT=10&FILTER=testlayer%20%C3%A8%C3%A9' + urllib.quote(':"NAME" = \'two\''),
'wms_getfeatureinfo_filter')

# Test a filter with OR condition results
self.wms_request_compare('GetFeatureInfo',
'&layers=testlayer%20%C3%A8%C3%A9&' +
'INFO_FORMAT=text%2Fxml&' +
'width=600&height=400&srs=EPSG%3A3857&' +
'query_layers=testlayer%20%C3%A8%C3%A9&' +
'FEATURE_COUNT=10&FILTER=testlayer%20%C3%A8%C3%A9' + urllib.quote(':"NAME" = \'two\' OR "NAME" = \'three\''),
'wms_getfeatureinfo_filter_or')

# Test a filter with OR condition and UTF results
# Note that the layer name that contains utf-8 chars cannot be
# to upper case.
self.wms_request_compare('GetFeatureInfo',
'&layers=testlayer%20%C3%A8%C3%A9&' +
'INFO_FORMAT=text%2Fxml&' +
'width=600&height=400&srs=EPSG%3A3857&' +
'query_layers=testlayer%20%C3%A8%C3%A9&' +
'FEATURE_COUNT=10&FILTER=testlayer%20%C3%A8%C3%A9' + urllib.quote(':"NAME" = \'two\' OR "utf8nameè" = \'three èé↓\''),
'wms_getfeatureinfo_filter_or_utf8')

def wms_inspire_request_compare(self, request):
"""WMS INSPIRE tests"""
project = self.testdata_path + "test_project_inspire.qgs"
Expand Down Expand Up @@ -917,5 +937,6 @@ def _img_diff_error(self, response, headers, image, max_diff=10, max_size_diff=Q

self.assertTrue(test, message)


if __name__ == '__main__':
unittest.main()
22 changes: 22 additions & 0 deletions tests/testdata/qgis_server/wms_getfeatureinfo_filter_or.txt
@@ -0,0 +1,22 @@
Content-Length: 943
Content-Type: text/xml; charset=utf-8

<GetFeatureInfoResponse>
<BoundingBox CRS="EPSG:3857" maxx="913214.67407005" minx="913204.91280263" maxy="5606017.87425818" miny="5606011.45647302"/>
<Layer name="testlayer èé">
<Feature id="1">
<Attribute value="2" name="id"/>
<Attribute value="two" name="name"/>
<Attribute value="two àò" name="utf8nameè"/>
<BoundingBox CRS="EPSG:3857" maxx="913214.6741" minx="913214.6741" maxy="5606017.8743" miny="5606017.8743"/>
<Attribute value="Point (913214.6741 5606017.8743)" type="derived" name="geometry"/>
</Feature>
<Feature id="2">
<Attribute value="3" name="id"/>
<Attribute value="three" name="name"/>
<Attribute value="three èé↓" name="utf8nameè"/>
<BoundingBox CRS="EPSG:3857" maxx="913204.9128" minx="913204.9128" maxy="5606011.4565" miny="5606011.4565"/>
<Attribute value="Point (913204.9128 5606011.4565)" type="derived" name="geometry"/>
</Feature>
</Layer>
</GetFeatureInfoResponse>
22 changes: 22 additions & 0 deletions tests/testdata/qgis_server/wms_getfeatureinfo_filter_or_utf8.txt
@@ -0,0 +1,22 @@
Content-Length: 943
Content-Type: text/xml; charset=utf-8

<GetFeatureInfoResponse>
<BoundingBox CRS="EPSG:3857" maxx="913214.67407005" minx="913204.91280263" maxy="5606017.87425818" miny="5606011.45647302"/>
<Layer name="testlayer èé">
<Feature id="1">
<Attribute value="2" name="id"/>
<Attribute value="two" name="name"/>
<Attribute value="two àò" name="utf8nameè"/>
<BoundingBox CRS="EPSG:3857" maxx="913214.6741" minx="913214.6741" maxy="5606017.8743" miny="5606017.8743"/>
<Attribute value="Point (913214.6741 5606017.8743)" type="derived" name="geometry"/>
</Feature>
<Feature id="2">
<Attribute value="3" name="id"/>
<Attribute value="three" name="name"/>
<Attribute value="three èé↓" name="utf8nameè"/>
<BoundingBox CRS="EPSG:3857" maxx="913204.9128" minx="913204.9128" maxy="5606011.4565" miny="5606011.4565"/>
<Attribute value="Point (913204.9128 5606011.4565)" type="derived" name="geometry"/>
</Feature>
</Layer>
</GetFeatureInfoResponse>
@@ -0,0 +1,7 @@
Content-Length: 151
Content-Type: text/xml; charset=utf-8

<GetFeatureInfoResponse>
<BoundingBox CRS="EPSG:3857" maxx="0" minx="0" maxy="0" miny="0"/>
<Layer name="testlayer èé"/>
</GetFeatureInfoResponse>

0 comments on commit 8fd4fc6

Please sign in to comment.