|
21 | 21 | from qgis.core import QgsMessageLog |
22 | 22 | from qgis.testing import unittest |
23 | 23 | from utilities import unitTestDataPath |
| 24 | +import osgeo.gdal |
24 | 25 |
|
25 | 26 | # Strip path and content length because path may vary |
26 | 27 | RE_STRIP_PATH = r'MAP=[^&]+|Content-Length: \d+' |
@@ -163,6 +164,11 @@ def wms_request_compare(self, request, extra=None, reference_file=None): |
163 | 164 | """ |
164 | 165 | response = re.sub(RE_STRIP_PATH, '', response) |
165 | 166 | expected = re.sub(RE_STRIP_PATH, '', expected) |
| 167 | + |
| 168 | + # for older GDAL versions (<2.0), id field will be integer type |
| 169 | + if int(osgeo.gdal.VersionInfo()[:1]) < 2: |
| 170 | + expected = expected.replace('typeName="Integer64" precision="0" length="10" editType="TextEdit" type="qlonglong"', 'typeName="Integer" precision="0" length="10" editType="TextEdit" type="int"') |
| 171 | + |
166 | 172 | self.assertEqual(response, expected, msg="request %s failed.\n Query: %s\n Expected:\n%s\n\n Response:\n%s" % (query_string, request, expected, response)) |
167 | 173 |
|
168 | 174 | def test_project_wms(self): |
@@ -240,10 +246,15 @@ def wfs_request_compare(self, request): |
240 | 246 | """ |
241 | 247 | response = re.sub(RE_STRIP_PATH, '', response) |
242 | 248 | expected = re.sub(RE_STRIP_PATH, '', expected) |
| 249 | + |
| 250 | + # for older GDAL versions (<2.0), id field will be integer type |
| 251 | + if int(osgeo.gdal.VersionInfo()[:1]) < 2: |
| 252 | + expected = expected.replace('<element type="long" name="id"/>', '<element type="integer" name="id"/>') |
| 253 | + |
243 | 254 | self.assertEqual(response, expected, msg="request %s failed.\n Query: %s\n Expected:\n%s\n\n Response:\n%s" % (query_string, request, expected, response)) |
244 | 255 |
|
245 | 256 | def test_project_wfs(self): |
246 | | - """Test some WMS request""" |
| 257 | + """Test some WFS request""" |
247 | 258 | for request in ('GetCapabilities', 'DescribeFeatureType'): |
248 | 259 | self.wfs_request_compare(request) |
249 | 260 |
|
|
0 commit comments