From 3c4567d0af8e9d4a2a5bd25d1e0739c85b2c40e0 Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Sat, 6 May 2017 10:45:10 +0200 Subject: [PATCH] [server] More WMS tests for FILTER parameter with bool operators and UTF8 Forward port from 2.18 commit 8fd4fc60697738a986207 --- tests/src/python/test_qgsserver_wms.py | 29 +++++++++++++++++++ .../wms_getfeatureinfo_filter_no_results.txt | 7 +++++ .../wms_getfeatureinfo_filter_or.txt | 22 ++++++++++++++ .../wms_getfeatureinfo_filter_or_utf8.txt | 22 ++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 tests/testdata/qgis_server/wms_getfeatureinfo_filter_no_results.txt create mode 100644 tests/testdata/qgis_server/wms_getfeatureinfo_filter_or.txt create mode 100644 tests/testdata/qgis_server/wms_getfeatureinfo_filter_or_utf8.txt diff --git a/tests/src/python/test_qgsserver_wms.py b/tests/src/python/test_qgsserver_wms.py index 22b660dde44..bc59158ec6b 100644 --- a/tests/src/python/test_qgsserver_wms.py +++ b/tests/src/python/test_qgsserver_wms.py @@ -96,6 +96,35 @@ class TestQgsServerWMS(QgsServerTestBase): 'FEATURE_COUNT=10&FILTER=testlayer%20%C3%A8%C3%A9' + urllib.parse.quote(':"NAME" = \'two\''), 'wms_getfeatureinfo_filter') + # Test a filter with NO 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.parse.quote(':"NAME" = \'two\' AND "utf8nameè" = \'no-results\''), + 'wms_getfeatureinfo_filter_no_results') + + # 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.parse.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.parse.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" diff --git a/tests/testdata/qgis_server/wms_getfeatureinfo_filter_no_results.txt b/tests/testdata/qgis_server/wms_getfeatureinfo_filter_no_results.txt new file mode 100644 index 00000000000..47b6c4581e8 --- /dev/null +++ b/tests/testdata/qgis_server/wms_getfeatureinfo_filter_no_results.txt @@ -0,0 +1,7 @@ +Content-Length: 151 +Content-Type: text/xml; charset=utf-8 + + + + + diff --git a/tests/testdata/qgis_server/wms_getfeatureinfo_filter_or.txt b/tests/testdata/qgis_server/wms_getfeatureinfo_filter_or.txt new file mode 100644 index 00000000000..e259cdf1a6d --- /dev/null +++ b/tests/testdata/qgis_server/wms_getfeatureinfo_filter_or.txt @@ -0,0 +1,22 @@ +Content-Length: 943 +Content-Type: text/xml; charset=utf-8 + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testdata/qgis_server/wms_getfeatureinfo_filter_or_utf8.txt b/tests/testdata/qgis_server/wms_getfeatureinfo_filter_or_utf8.txt new file mode 100644 index 00000000000..e259cdf1a6d --- /dev/null +++ b/tests/testdata/qgis_server/wms_getfeatureinfo_filter_or_utf8.txt @@ -0,0 +1,22 @@ +Content-Length: 943 +Content-Type: text/xml; charset=utf-8 + + + + + + + + + + + + + + + + + + + +