Skip to content

Commit

Permalink
[Tests][Server] Add unit test for empty contextual legend
Browse files Browse the repository at this point in the history
Manually port c217cbb
  • Loading branch information
rldhont committed Apr 24, 2018
1 parent 235402d commit 2275ebb
Show file tree
Hide file tree
Showing 2 changed files with 3,058 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/src/python/test_qgsserver_wms_getlegendgraphic.py
Expand Up @@ -469,6 +469,25 @@ def test_wms_GetLegendGraphic_BBox2(self):
r, h = self._result(self._execute_request(qs))
self._img_diff_error(r, h, "WMS_GetLegendGraphic_BBox2")

def test_wms_GetLegendGraphic_EmptyLegend(self):
qs = "?" + "&".join(["%s=%s" % i for i in list({
"MAP": self.testdata_path + 'test_project_contextual_legend.qgs',
"SERVICE": "WMS",
"VERSION": "1.1.1",
"REQUEST": "GetLegendGraphic",
"LAYER": "QGIS%20Server%20Hello%20World",
"FORMAT": "image/png",
"HEIGHT": "840",
"WIDTH": "1226",
"BBOX": "10.38450,-49.6370,73.8183,42.9461",
"SRS": "EPSG:4326",
"SCALE": "15466642"
}.items())])

h, r = self._execute_request(qs)
self.assertEqual(-1, h.find(b'Content-Type: text/xml; charset=utf-8'), "Header: %s\nResponse:\n%s" % (h, r))
self.assertNotEqual(-1, h.find(b'Content-Type: image/png'), "Header: %s\nResponse:\n%s" % (h, r))


if __name__ == '__main__':
unittest.main()

0 comments on commit 2275ebb

Please sign in to comment.