From 1afe0d1bb8c3552de8178882dda4d97708b69485 Mon Sep 17 00:00:00 2001 From: Blottiere Paul Date: Thu, 26 Apr 2018 16:18:29 +0100 Subject: [PATCH] Add unit tests --- tests/src/python/test_qgsserver_wms.py | 17 + .../test_project_without_title.qgs | 781 ++++++++++++++++++ .../wms_getcapabilities_without_title.txt | 131 +++ 3 files changed, 929 insertions(+) create mode 100644 tests/testdata/qgis_server/test_project_without_title.qgs create mode 100644 tests/testdata/qgis_server/wms_getcapabilities_without_title.txt diff --git a/tests/src/python/test_qgsserver_wms.py b/tests/src/python/test_qgsserver_wms.py index 99c5a9493fc..1e061b13c24 100644 --- a/tests/src/python/test_qgsserver_wms.py +++ b/tests/src/python/test_qgsserver_wms.py @@ -146,6 +146,23 @@ class TestQgsServerWMS(TestQgsServerWMSTestBase): for request in ('GetCapabilities',): self.wms_inspire_request_compare(request) + def test_wms_getcapabilities_without_title(self): + # Empty title in project leads to a Layer element without Name, Title + # and Abstract tags. However, it should still have a CRS and a BBOX + # according to OGC specifications tests. + project = os.path.join(self.testdata_path, "test_project_without_title.qgs") + qs = "?" + "&".join(["%s=%s" % i for i in list({ + "MAP": urllib.parse.quote(project), + "SERVICE": "WMS", + "VERSION": "1.3.0", + "REQUEST": "GetCapabilities", + "STYLES": "" + }.items())]) + + r, h = self._result(self._execute_request(qs)) + + self.wms_request_compare('GetCapabilities', reference_file='wms_getcapabilities_without_title', project='test_project_without_title.qgs') + def test_wms_getcapabilities_url(self): # empty url in project project = os.path.join(self.testdata_path, "test_project_without_urls.qgs") diff --git a/tests/testdata/qgis_server/test_project_without_title.qgs b/tests/testdata/qgis_server/test_project_without_title.qgs new file mode 100644 index 00000000000..4d670854e11 --- /dev/null +++ b/tests/testdata/qgis_server/test_project_without_title.qgs @@ -0,0 +1,781 @@ + + + + + + + + + + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + WGS84 + true + + + + + + + + + france_parts_571c9cdc_54fb_4fe1_8657_bbc58a767b87 + + + + + + + + + + degrees + + -5.33889081436202328 + 46.19300890773994439 + 3.32419280355761426 + 49.81265618522981953 + + 0 + + + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + WGS84 + true + + + 0 + + + + + + + + + degrees + + 0 + 0 + 0 + 0 + + 0 + + + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + WGS84 + true + + + 0 + + + degrees + + 0 + 0 + 0 + 0 + + 0 + + + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + WGS84 + true + + + 0 + + + degrees + + 0 + 0 + 0 + 0 + + 0 + + + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + WGS84 + true + + + 0 + + + + + -5.1326269186972695 + 46.2791909857754149 + 3.11792890789286048 + 49.72647410719434902 + + france_parts_571c9cdc_54fb_4fe1_8657_bbc58a767b87 + ../france_parts.shp + + + + france_parts + + + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + WGS84 + true + + + + + + + + + + + + + + + + 0 + 0 + + + + + false + + + + + ogr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + 0 + generatedlayout + + + + + + + + + + + + + + + + + 5000 + + + + + + + + + + EPSG:4326 + 3452 + 1 + +proj=longlat +datum=WGS84 +no_defs + + 5000 + + false + + + 255 + + + + + true + + + + conditions unknown + + m2 + meters + + + + + + + 90 + None + + + + + NONE + + false + + false + + + false + + 8 + + 2 + true + MU + + + false + + + + + + + 0 + 255 + 255 + 255 + 255 + 255 + 255 + + false + + false + + + + + + + + + + + + + + + + + diff --git a/tests/testdata/qgis_server/wms_getcapabilities_without_title.txt b/tests/testdata/qgis_server/wms_getcapabilities_without_title.txt new file mode 100644 index 00000000000..465bd11009f --- /dev/null +++ b/tests/testdata/qgis_server/wms_getcapabilities_without_title.txt @@ -0,0 +1,131 @@ +Content-Length: 5775 +Content-Type: text/xml; charset=utf-8 + + + + + WMS + + infoMapAccessService + + + conditions unknown + None + + + + + text/xml + + + + + + + + + + image/jpeg + image/png + image/png; mode=16bit + image/png; mode=8bit + image/png; mode=1bit + application/dxf + + + + + + + + + + text/plain + text/html + text/xml + application/vnd.ogc.gml + application/vnd.ogc.gml/3.1.1 + + + + + + + + + + image/jpeg + image/png + + + + + + + + + + text/xml + + + + + + + + + + text/xml + + + + + + + + + + + XML + + + + infoMapAccessService + + CRS:84 + EPSG:4326 + EPSG:3857 + + -5.13262 + 3.11793 + 46.2792 + 49.7265 + + + + + france_parts + france_parts + CRS:84 + EPSG:4326 + EPSG:3857 + + -5.13263 + 3.11793 + 46.2792 + 49.7265 + + + + + + + +