Skip to content
Permalink
Browse files

Add unit tests for json format

  • Loading branch information
pblottiere committed Sep 28, 2020
1 parent 5d18f98 commit 5c74aeeb11023e73870d581ad4ac703226be4b37
@@ -803,7 +803,7 @@ def testGetFeatureInfoCascadingLayers(self):
project_name)

def testGetFeatureInfoRasterNoData(self):
# out text
# outside the image in text
self.wms_request_compare('GetFeatureInfo',
'&BBOX=-39.43236293126383885,135.95002698514588246,-30.54405018572365194,156.29582900705395332' +
'&CRS=EPSG:4326' +
@@ -845,7 +845,7 @@ def testGetFeatureInfoRasterNoData(self):
'test_raster_nodata.qgz',
raw=True)

# out html
# outside the image in html
self.wms_request_compare('GetFeatureInfo',
'&BBOX=-39.43236293126383885,135.95002698514588246,-30.54405018572365194,156.29582900705395332' +
'&CRS=EPSG:4326' +
@@ -890,6 +890,51 @@ def testGetFeatureInfoRasterNoData(self):
'test_raster_nodata.qgz',
raw=True)

# outside the image in json
self.wms_request_compare('GetFeatureInfo',
'&BBOX=-39.43236293126383885,135.95002698514588246,-30.54405018572365194,156.29582900705395332' +
'&CRS=EPSG:4326' +
'&VERSION=1.3.0' +
'&INFO_FORMAT=application/json' +
'&WIDTH=800&HEIGHT=400' +
'&LAYERS=requires_warped_vrt' +
'&QUERY_LAYERS=requires_warped_vrt' +
'&I=1&J=1' +
'&FEATURE_COUNT=10',
'wms_getfeatureinfo_raster_nodata_out_json',
'test_raster_nodata.qgz',
raw=True)

# 0 json
self.wms_request_compare('GetFeatureInfo',
'&BBOX=-39.43236293126383885,135.95002698514588246,-30.54405018572365194,156.29582900705395332' +
'&CRS=EPSG:4326' +
'&VERSION=1.3.0' +
'&INFO_FORMAT=application/json' +
'&WIDTH=800&HEIGHT=400' +
'&LAYERS=requires_warped_vrt' +
'&QUERY_LAYERS=requires_warped_vrt' +
'&I=576&J=163' +
'&FEATURE_COUNT=10',
'wms_getfeatureinfo_raster_nodata_zero_json',
'test_raster_nodata.qgz',
raw=True)

# nodata json
self.wms_request_compare('GetFeatureInfo',
'&BBOX=-39.43236293126383885,135.95002698514588246,-30.54405018572365194,156.29582900705395332' +
'&CRS=EPSG:4326' +
'&VERSION=1.3.0' +
'&INFO_FORMAT=application/json' +
'&WIDTH=800&HEIGHT=400' +
'&LAYERS=requires_warped_vrt' +
'&QUERY_LAYERS=requires_warped_vrt' +
'&I=560&J=78' +
'&FEATURE_COUNT=10',
'wms_getfeatureinfo_raster_nodata_json',
'test_raster_nodata.qgz',
raw=True)


if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,2 @@
*****
Content-Type: application/json; charset=utf-8{"features": [{"id": "requires_warped_vrt", "properties": {"Band 1": "null"}, "type": "Feature"}], "type": "FeatureCollection"}
@@ -0,0 +1,2 @@
*****
Content-Type: application/json; charset=utf-8{"features": [{"id": "requires_warped_vrt", "properties": {}, "type": "Feature"}], "type": "FeatureCollection"}
@@ -0,0 +1,2 @@
*****
Content-Type: application/json; charset=utf-8{"features": [{"id": "requires_warped_vrt", "properties": {"Band 1": "0"}, "type": "Feature"}], "type": "FeatureCollection"}

0 comments on commit 5c74aee

Please sign in to comment.
You can’t perform that action at this time.