Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add unit test with multiple layers and features for json
  • Loading branch information
pblottiere committed Jan 28, 2019
1 parent 5ef1139 commit 2f683fc
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/src/python/test_qgsserver_wms_getfeatureinfo.py
Expand Up @@ -442,6 +442,16 @@ def testGetFeatureInfoJSON(self):
'query_layers=testlayer%20%C3%A8%C3%A9&X=190&Y=320',
'wms_getfeatureinfo_json')

# test with several features and several layers
self.wms_request_compare('GetFeatureInfo',
'&layers=testlayer%20%C3%A8%C3%A9,fields_alias,exclude_attribute&styles=&' +
'info_format=application%2Fjson&transparent=true&' +
'width=600&height=400&srs=EPSG%3A3857&bbox=913190.6389747962%2C' +
'5606005.488876367%2C913235.426296057%2C5606035.347090538&' +
'query_layers=testlayer%20%C3%A8%C3%A9,fields_alias,exclude_attribute&' +
'X=190&Y=320&FEATURE_COUNT=2&FI_POINT_TOLERANCE=200',
'wms_getfeatureinfo_multiple_json')

# simple test with geometry
self.wms_request_compare('GetFeatureInfo',
'&layers=testlayer%20%C3%A8%C3%A9&styles=&' +
Expand Down
74 changes: 74 additions & 0 deletions tests/testdata/qgis_server/wms_getfeatureinfo_multiple_json.txt
@@ -0,0 +1,74 @@
*****
Content-Type: application/json; charset=utf-8

{"layers":[{
"name": "testlayer èé",
"type": "FeatureCollection",
"features":[
{
"type":"Feature",
"id":0,
"geometry":null,
"properties":{
"id":1,
"name":"one",
"utf8nameè":"one èé"
}
},
{
"type":"Feature",
"id":1,
"geometry":null,
"properties":{
"id":2,
"name":"two",
"utf8nameè":"two àò"
}
}
]},{
"name": "fields_alias",
"type": "FeatureCollection",
"features":[
{
"type":"Feature",
"id":0,
"geometry":null,
"properties":{
"alias_id":1,
"alias_name":"one",
"utf8nameè":"one èé"
}
},
{
"type":"Feature",
"id":1,
"geometry":null,
"properties":{
"alias_id":2,
"alias_name":"two",
"utf8nameè":"two àò"
}
}
]},{
"name": "exclude_attribute",
"type": "FeatureCollection",
"features":[
{
"type":"Feature",
"id":0,
"geometry":null,
"properties":{
"id":1,
"utf8nameè":"one èé"
}
},
{
"type":"Feature",
"id":1,
"geometry":null,
"properties":{
"id":2,
"utf8nameè":"two àò"
}
}
]}]}

0 comments on commit 2f683fc

Please sign in to comment.