Skip to content
Permalink
Browse files

Add unit test for empty contextual legend

  • Loading branch information
mhugent committed Apr 17, 2018
1 parent bf2ed36 commit c217cbb4dd140695af74debbe052dbefc1d21e74
Showing with 3,720 additions and 0 deletions.
  1. +19 −0 tests/src/python/test_qgsserver.py
  2. +3,701 −0 tests/testdata/qgis_server/test_project_contextual_legend.qgs
@@ -893,6 +893,25 @@ def test_wms_GetLegendGraphic_BBox2(self):
r, h = self._result(self.server.handleRequest(qs))
self._img_diff_error(r, h, "WMS_GetLegendGraphic_BBox2")

def test_wms_GetLegendGraphic_EmptyLegend(self):
mapPath = self.testdata_path + 'test_project_contextual_legend.qgs'
qs = "&".join(["%s=%s" % i for i in list({
"MAP": urllib.quote(mapPath),
"SERVICE": "WMS",
"VERSION": "1.3.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())])

r, h = self._result(self.server.handleRequest(qs) )
self.assertTrue( h['Content-Type'] == 'image/png' )

def _result(self, data):
headers = {}
for line in data[0].decode('UTF-8').split("\n"):

0 comments on commit c217cbb

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