Skip to content

Commit 3d20cfe

Browse files
authoredJul 17, 2018
Merge pull request #7279 from tudorbarascu/tests
rework server test to use geopackage and qgz
2 parents d27c1aa + deb9f59 commit 3d20cfe

9 files changed

+47
-1693
lines changed
 

‎tests/src/python/test_qgsserver_wms_getfeatureinfo.py

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ def testGetFeatureInfo(self):
167167
'wms_getfeatureinfo_notvisible',
168168
'test_project_scalevisibility.qgs')
169169

170-
# Test GetFeatureInfo resolves "value map" widget values
171-
mypath = self.testdata_path + "test_project_values.qgs"
170+
# Test GetFeatureInfo resolves "value map" widget values but also Server usage of qgs and gpkg file
171+
mypath = self.testdata_path + "test_project_values.qgz"
172172
self.wms_request_compare('GetFeatureInfo',
173173
'&layers=layer0&styles=&' +
174174
'VERSION=1.3.0&' +
@@ -179,11 +179,11 @@ def testGetFeatureInfo(self):
179179
'&FEATURE_COUNT=10' +
180180
'&QUERY_LAYERS=layer0&I=487&J=308',
181181
'wms_getfeatureinfo-values0-text-xml',
182-
'test_project_values.qgs')
182+
'test_project_values.qgz')
183183

184184
def testGetFeatureInfoValueRelation(self):
185185
"""Test GetFeatureInfo resolves "value relation" widget values. regression 18518"""
186-
mypath = self.testdata_path + "test_project_values.qgs"
186+
mypath = self.testdata_path + "test_project_values.qgz"
187187
self.wms_request_compare('GetFeatureInfo',
188188
'&layers=layer1&styles=&' +
189189
'VERSION=1.3.0&' +
@@ -195,13 +195,13 @@ def testGetFeatureInfoValueRelation(self):
195195
'&WITH_GEOMETRY=True' +
196196
'&QUERY_LAYERS=layer1&I=487&J=308',
197197
'wms_getfeatureinfo-values1-text-xml',
198-
'test_project_values.qgs')
198+
'test_project_values.qgz')
199199

200200
# TODO make GetFeatureInfo show the dictionary values and enable test
201201
@unittest.expectedFailure
202202
def testGetFeatureInfoValueRelationArray(self):
203203
"""Test GetFeatureInfo on "value relation" widget with array field (multiple selections)"""
204-
mypath = self.testdata_path + "test_project_values.qgs"
204+
mypath = self.testdata_path + "test_project_values.qgz"
205205
self.wms_request_compare('GetFeatureInfo',
206206
'&layers=layer3&styles=&' +
207207
'VERSION=1.3.0&' +
@@ -213,13 +213,13 @@ def testGetFeatureInfoValueRelationArray(self):
213213
'&WITH_GEOMETRY=True' +
214214
'&QUERY_LAYERS=layer3&I=487&J=308',
215215
'wms_getfeatureinfo-values3-text-xml',
216-
'test_project_values.qgs')
216+
'test_project_values.qgz')
217217

218218
# TODO make GetFeatureInfo show what's in the display expression and enable test
219219
@unittest.expectedFailure
220220
def testGetFeatureInfoRelationReference(self):
221221
"""Test GetFeatureInfo solves "relation reference" widget "display expression" values"""
222-
mypath = self.testdata_path + "test_project_values.qgs"
222+
mypath = self.testdata_path + "test_project_values.qgz"
223223
self.wms_request_compare('GetFeatureInfo',
224224
'&layers=layer2&styles=&' +
225225
'VERSION=1.3.0&' +
@@ -231,7 +231,22 @@ def testGetFeatureInfoRelationReference(self):
231231
'&WITH_GEOMETRY=True' +
232232
'&QUERY_LAYERS=layer2&I=487&J=308',
233233
'wms_getfeatureinfo-values2-text-xml',
234-
'test_project_values.qgs')
234+
'test_project_values.qgz')
235+
236+
# TODO make filter work with gpkg and move test inside testGetFeatureInfoFilter function
237+
@unittest.expectedFailure
238+
def testGetFeatureInfoFilterGPKG(self):
239+
# 'test_project.qgz' ='test_project.qgs' but with a gpkg source + different fid
240+
# Regression for #8656 Test getfeatureinfo response xml with gpkg datasource
241+
# Mind the gap! (the space in the FILTER expression)
242+
self.wms_request_compare('GetFeatureInfo',
243+
'&layers=testlayer%20%C3%A8%C3%A9&' +
244+
'INFO_FORMAT=text%2Fxml&' +
245+
'width=600&height=400&srs=EPSG%3A3857&' +
246+
'query_layers=testlayer%20%C3%A8%C3%A9&' +
247+
'FEATURE_COUNT=10&FILTER=testlayer%20%C3%A8%C3%A9' + urllib.parse.quote(':"NAME" = \'two\''),
248+
'wms_getfeatureinfo_filter_gpkg',
249+
'test_project.qgz')
235250

236251
def testGetFeatureInfoFilter(self):
237252
# Test getfeatureinfo response xml

‎tests/testdata/qgis_server/db.gpkg

96 KB
Binary file not shown.
6.21 KB
Binary file not shown.

‎tests/testdata/qgis_server/test_project_values.qgs

Lines changed: 0 additions & 1675 deletions
This file was deleted.
Binary file not shown.

‎tests/testdata/qgis_server/wms_getfeatureinfo-values0-text-xml.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ Content-Type: text/xml; charset=utf-8
33

44
<GetFeatureInfoResponse>
55
<Layer name="layer0">
6-
<Feature id="0">
6+
<Feature id="1">
77
<Attribute value="1" name="id"/>
88
<Attribute value="one" name="name"/>
99
<Attribute value="First Value" name="utf8nameè"/>
1010
</Feature>
11-
<Feature id="1">
11+
<Feature id="2">
1212
<Attribute value="2" name="id"/>
1313
<Attribute value="two" name="name"/>
1414
<Attribute value="Second Value" name="utf8nameè"/>
1515
</Feature>
16-
<Feature id="2">
16+
<Feature id="3">
1717
<Attribute value="3" name="id"/>
1818
<Attribute value="three" name="name"/>
1919
<Attribute value="Third èé↓" name="utf8nameè"/>

‎tests/testdata/qgis_server/wms_getfeatureinfo-values1-text-xml.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ Content-Type: text/xml; charset=utf-8
33

44
<GetFeatureInfoResponse>
55
<Layer name="layer1">
6-
<Feature id="0">
6+
<Feature id="1">
77
<Attribute value="Id no. 1 value" name="id"/>
88
<Attribute value="one_value" name="name"/>
99
<Attribute value="one èé" name="utf8nameè"/>
1010
<BoundingBox maxy="5606025.2373" maxx="913209.0358" miny="5606025.2373" CRS="EPSG:3857" minx="913209.0358"/>
1111
<Attribute type="derived" value="Point (913209.0358 5606025.2373)" name="geometry"/>
1212
</Feature>
13-
<Feature id="1">
13+
<Feature id="2">
1414
<Attribute value="Id no. 2 value" name="id"/>
1515
<Attribute value="two_val" name="name"/>
1616
<Attribute value="two àò" name="utf8nameè"/>
1717
<BoundingBox maxy="5606017.8743" maxx="913214.6741" miny="5606017.8743" CRS="EPSG:3857" minx="913214.6741"/>
1818
<Attribute type="derived" value="Point (913214.6741 5606017.8743)" name="geometry"/>
1919
</Feature>
20-
<Feature id="2">
20+
<Feature id="3">
2121
<Attribute value="Id número 3 value" name="id"/>
2222
<Attribute value="three_val" name="name"/>
2323
<Attribute value="three èé↓" name="utf8nameè"/>

‎tests/testdata/qgis_server/wms_getfeatureinfo-values2-text-xml.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ Content-Type: text/xml; charset=utf-8
33

44
<GetFeatureInfoResponse>
55
<Layer name="layer2">
6-
<Feature id="0">
6+
<Feature id="1">
77
<Attribute value="value PE 1000 PN6" name="id"/>
88
<Attribute value="one" name="name"/>
99
<Attribute value="one èé" name="utf8nameè"/>
1010
<BoundingBox maxy="5606025.2373" maxx="913209.0358" miny="5606025.2373" CRS="EPSG:3857" minx="913209.0358"/>
1111
<Attribute type="derived" value="Point (913209.0358 5606025.2373)" name="geometry"/>
1212
</Feature>
13-
<Feature id="1">
13+
<Feature id="2">
1414
<Attribute value="value PE" name="id"/>
1515
<Attribute value="two" name="name"/>
1616
<Attribute value="two àò" name="utf8nameè"/>
1717
<BoundingBox maxy="5606017.8743" maxx="913214.6741" miny="5606017.8743" CRS="EPSG:3857" minx="913214.6741"/>
1818
<Attribute type="derived" value="Point (913214.6741 5606017.8743)" name="geometry"/>
1919
</Feature>
20-
<Feature id="2">
20+
<Feature id="3">
2121
<Attribute value="value PE 1000 PN8" name="id"/>
2222
<Attribute value="three" name="name"/>
2323
<Attribute value="three èé↓" name="utf8nameè"/>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Content-Length: 577
2+
Content-Type: text/xml; charset=utf-8
3+
4+
<GetFeatureInfoResponse>
5+
<BoundingBox maxy="5606017.87425818" maxx="913214.67407005" miny="5606017.87425818" CRS="EPSG:3857" minx="913214.67407005"/>
6+
<Layer name="testlayer èé">
7+
<Feature id="2">
8+
<Attribute value="2" name="id"/>
9+
<Attribute value="two" name="name"/>
10+
<Attribute value="two àò" name="utf8nameè"/>
11+
<BoundingBox maxy="5606017.8743" maxx="913214.6741" miny="5606017.8743" CRS="EPSG:3857" minx="913214.6741"/>
12+
</Feature>
13+
</Layer>
14+
</GetFeatureInfoResponse>

0 commit comments

Comments
 (0)
Please sign in to comment.