Skip to content

Commit a7133f5

Browse files
committedJan 27, 2017
[Server] Backport tests
1 parent 000e974 commit a7133f5

File tree

28 files changed

+993
-9
lines changed

28 files changed

+993
-9
lines changed
 

‎tests/src/python/test_qgsserver.py

Lines changed: 317 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,323 @@ def test_getfeature_post(self):
362362
for id, req in tests:
363363
self.wfs_getfeature_post_compare(id, req)
364364

365+
def test_wms_getmap_basic(self):
366+
qs = "&".join(["%s=%s" % i for i in list({
367+
"MAP": urllib.quote(self.projectPath),
368+
"SERVICE": "WMS",
369+
"VERSION": "1.1.1",
370+
"REQUEST": "GetMap",
371+
"LAYERS": "Country",
372+
"STYLES": "",
373+
"FORMAT": "image/png",
374+
"BBOX": "-16817707,-4710778,5696513,14587125",
375+
"HEIGHT": "500",
376+
"WIDTH": "500",
377+
"CRS": "EPSG:3857"
378+
}.items())])
379+
380+
r, h = self._result(self.server.handleRequest(qs))
381+
self._img_diff_error(r, h, "WMS_GetMap_Basic")
382+
383+
def test_wms_getmap_transparent(self):
384+
qs = "&".join(["%s=%s" % i for i in list({
385+
"MAP": urllib.quote(self.projectPath),
386+
"SERVICE": "WMS",
387+
"VERSION": "1.1.1",
388+
"REQUEST": "GetMap",
389+
"LAYERS": "Country",
390+
"STYLES": "",
391+
"FORMAT": "image/png",
392+
"BBOX": "-16817707,-4710778,5696513,14587125",
393+
"HEIGHT": "500",
394+
"WIDTH": "500",
395+
"CRS": "EPSG:3857",
396+
"TRANSPARENT": "TRUE"
397+
}.items())])
398+
399+
r, h = self._result(self.server.handleRequest(qs))
400+
self._img_diff_error(r, h, "WMS_GetMap_Transparent")
401+
402+
def test_wms_getmap_background(self):
403+
qs = "&".join(["%s=%s" % i for i in list({
404+
"MAP": urllib.quote(self.projectPath),
405+
"SERVICE": "WMS",
406+
"VERSION": "1.1.1",
407+
"REQUEST": "GetMap",
408+
"LAYERS": "Country",
409+
"STYLES": "",
410+
"FORMAT": "image/png",
411+
"BBOX": "-16817707,-4710778,5696513,14587125",
412+
"HEIGHT": "500",
413+
"WIDTH": "500",
414+
"CRS": "EPSG:3857",
415+
"BGCOLOR": "green"
416+
}.items())])
417+
418+
r, h = self._result(self.server.handleRequest(qs))
419+
self._img_diff_error(r, h, "WMS_GetMap_Background")
420+
421+
qs = "&".join(["%s=%s" % i for i in list({
422+
"MAP": urllib.quote(self.projectPath),
423+
"SERVICE": "WMS",
424+
"VERSION": "1.1.1",
425+
"REQUEST": "GetMap",
426+
"LAYERS": "Country",
427+
"STYLES": "",
428+
"FORMAT": "image/png",
429+
"BBOX": "-16817707,-4710778,5696513,14587125",
430+
"HEIGHT": "500",
431+
"WIDTH": "500",
432+
"CRS": "EPSG:3857",
433+
"BGCOLOR": "0x008000"
434+
}.items())])
435+
436+
r, h = self._result(self.server.handleRequest(qs))
437+
self._img_diff_error(r, h, "WMS_GetMap_Background_Hex")
438+
439+
def test_wms_getmap_order(self):
440+
qs = "&".join(["%s=%s" % i for i in list({
441+
"MAP": urllib.quote(self.projectPath),
442+
"SERVICE": "WMS",
443+
"VERSION": "1.1.1",
444+
"REQUEST": "GetMap",
445+
"LAYERS": "Hello,Country",
446+
"STYLES": "",
447+
"FORMAT": "image/png",
448+
"BBOX": "-16817707,-4710778,5696513,14587125",
449+
"HEIGHT": "500",
450+
"WIDTH": "500",
451+
"CRS": "EPSG:3857"
452+
}.items())])
453+
454+
r, h = self._result(self.server.handleRequest(qs))
455+
self._img_diff_error(r, h, "WMS_GetMap_LayerOrder")
456+
457+
def test_wms_getmap_srs(self):
458+
qs = "&".join(["%s=%s" % i for i in list({
459+
"MAP": urllib.quote(self.projectPath),
460+
"SERVICE": "WMS",
461+
"VERSION": "1.1.1",
462+
"REQUEST": "GetMap",
463+
"LAYERS": "Country,Hello",
464+
"STYLES": "",
465+
"FORMAT": "image/png",
466+
"BBOX": "-151.7,-38.9,51.0,78.0",
467+
"HEIGHT": "500",
468+
"WIDTH": "500",
469+
"CRS": "EPSG:4326"
470+
}.items())])
471+
472+
r, h = self._result(self.server.handleRequest(qs))
473+
self._img_diff_error(r, h, "WMS_GetMap_SRS")
474+
475+
def test_wms_getmap_style(self):
476+
# default style
477+
qs = "&".join(["%s=%s" % i for i in list({
478+
"MAP": urllib.quote(self.projectPath),
479+
"SERVICE": "WMS",
480+
"VERSION": "1.1.1",
481+
"REQUEST": "GetMap",
482+
"LAYERS": "Country_Labels",
483+
"STYLES": "",
484+
"FORMAT": "image/png",
485+
"BBOX": "-16817707,-4710778,5696513,14587125",
486+
"HEIGHT": "500",
487+
"WIDTH": "500",
488+
"CRS": "EPSG:3857"
489+
}.items())])
490+
491+
r, h = self._result(self.server.handleRequest(qs))
492+
self._img_diff_error(r, h, "WMS_GetMap_StyleDefault")
493+
494+
# custom style
495+
qs = "&".join(["%s=%s" % i for i in list({
496+
"MAP": urllib.quote(self.projectPath),
497+
"SERVICE": "WMS",
498+
"VERSION": "1.1.1",
499+
"REQUEST": "GetMap",
500+
"LAYERS": "Country_Labels",
501+
"STYLES": "custom",
502+
"FORMAT": "image/png",
503+
"BBOX": "-16817707,-4710778,5696513,14587125",
504+
"HEIGHT": "500",
505+
"WIDTH": "500",
506+
"CRS": "EPSG:3857"
507+
}.items())])
508+
509+
r, h = self._result(self.server.handleRequest(qs))
510+
self._img_diff_error(r, h, "WMS_GetMap_StyleCustom")
511+
512+
def test_wms_getmap_filter(self):
513+
qs = "&".join(["%s=%s" % i for i in list({
514+
"MAP": urllib.quote(self.projectPath),
515+
"SERVICE": "WMS",
516+
"VERSION": "1.1.1",
517+
"REQUEST": "GetMap",
518+
"LAYERS": "Country,Hello",
519+
"STYLES": "",
520+
"FORMAT": "image/png",
521+
"BBOX": "-16817707,-4710778,5696513,14587125",
522+
"HEIGHT": "500",
523+
"WIDTH": "500",
524+
"CRS": "EPSG:3857",
525+
"FILTER": "Country:\"name\" = 'eurasia'"
526+
}.items())])
527+
528+
r, h = self._result(self.server.handleRequest(qs))
529+
self._img_diff_error(r, h, "WMS_GetMap_Filter")
530+
531+
def test_wms_getmap_selection(self):
532+
qs = "&".join(["%s=%s" % i for i in list({
533+
"MAP": urllib.quote(self.projectPath),
534+
"SERVICE": "WMS",
535+
"VERSION": "1.1.1",
536+
"REQUEST": "GetMap",
537+
"LAYERS": "Country,Hello",
538+
"STYLES": "",
539+
"FORMAT": "image/png",
540+
"BBOX": "-16817707,-4710778,5696513,14587125",
541+
"HEIGHT": "500",
542+
"WIDTH": "500",
543+
"SRS": "EPSG:3857",
544+
"SELECTION": "Country: 4"
545+
}.items())])
546+
547+
r, h = self._result(self.server.handleRequest(qs))
548+
self._img_diff_error(r, h, "WMS_GetMap_Selection")
549+
550+
def test_wms_getmap_opacities(self):
551+
qs = "&".join(["%s=%s" % i for i in list({
552+
"MAP": urllib.quote(self.projectPath),
553+
"SERVICE": "WMS",
554+
"VERSION": "1.1.1",
555+
"REQUEST": "GetMap",
556+
"LAYERS": "Country,Hello",
557+
"STYLES": "",
558+
"FORMAT": "image/png",
559+
"BBOX": "-16817707,-4710778,5696513,14587125",
560+
"HEIGHT": "500",
561+
"WIDTH": "500",
562+
"CRS": "EPSG:3857",
563+
"OPACITIES": "125, 50"
564+
}.items())])
565+
566+
r, h = self._result(self.server.handleRequest(qs))
567+
self._img_diff_error(r, h, "WMS_GetMap_Opacities")
568+
569+
def test_wms_getprint_basic(self):
570+
qs = "&".join(["%s=%s" % i for i in list({
571+
"MAP": urllib.quote(self.projectPath),
572+
"SERVICE": "WMS",
573+
"VERSION": "1.1.1",
574+
"REQUEST": "GetPrint",
575+
"TEMPLATE": "layoutA4",
576+
"FORMAT": "png",
577+
"map0:EXTENT": "-33626185.498,-13032965.185,33978427.737,16020257.031",
578+
"map0:LAYERS": "Hello,Country", # inverted
579+
"HEIGHT": "500",
580+
"WIDTH": "500",
581+
"CRS": "EPSG:3857"
582+
}.items())])
583+
584+
r, h = self._result(self.server.handleRequest(qs))
585+
self._img_diff_error(r, h, "WMS_GetPrint_Basic")
586+
587+
def test_wms_getprint_srs(self):
588+
qs = "&".join(["%s=%s" % i for i in list({
589+
"MAP": urllib.quote(self.projectPath),
590+
"SERVICE": "WMS",
591+
"VERSION": "1.1.1",
592+
"REQUEST": "GetPrint",
593+
"TEMPLATE": "layoutA4",
594+
"FORMAT": "png",
595+
"map0:EXTENT": "-309.015,-133.011,312.179,133.949",
596+
"map0:LAYERS": "Hello,Country", # inverted
597+
"HEIGHT": "500",
598+
"WIDTH": "500",
599+
"CRS": "EPSG:4326"
600+
}.items())])
601+
602+
r, h = self._result(self.server.handleRequest(qs))
603+
self._img_diff_error(r, h, "WMS_GetPrint_SRS")
604+
605+
def test_wms_getprint_scale(self):
606+
qs = "&".join(["%s=%s" % i for i in list({
607+
"MAP": urllib.quote(self.projectPath),
608+
"SERVICE": "WMS",
609+
"VERSION": "1.1.1",
610+
"REQUEST": "GetPrint",
611+
"TEMPLATE": "layoutA4",
612+
"FORMAT": "png",
613+
"map0:EXTENT": "-33626185.498,-13032965.185,33978427.737,16020257.031",
614+
"map0:LAYERS": "Hello,Country", # inverted
615+
"map0:SCALE": "36293562",
616+
"HEIGHT": "500",
617+
"WIDTH": "500",
618+
"CRS": "EPSG:3857"
619+
}.items())])
620+
621+
r, h = self._result(self.server.handleRequest(qs))
622+
self._img_diff_error(r, h, "WMS_GetPrint_Scale")
623+
624+
def test_wms_getprint_grid(self):
625+
qs = "&".join(["%s=%s" % i for i in list({
626+
"MAP": urllib.quote(self.projectPath),
627+
"SERVICE": "WMS",
628+
"VERSION": "1.1.1",
629+
"REQUEST": "GetPrint",
630+
"TEMPLATE": "layoutA4",
631+
"FORMAT": "png",
632+
"map0:EXTENT": "-33626185.498,-13032965.185,33978427.737,16020257.031",
633+
"map0:LAYERS": "Hello,Country", # inverted
634+
"map0:GRID_INTERVAL_X": "1000000",
635+
"map0:GRID_INTERVAL_Y": "2000000",
636+
"HEIGHT": "500",
637+
"WIDTH": "500",
638+
"CRS": "EPSG:3857"
639+
}.items())])
640+
641+
r, h = self._result(self.server.handleRequest(qs))
642+
self._img_diff_error(r, h, "WMS_GetPrint_Grid")
643+
644+
def test_wms_getprint_rotation(self):
645+
qs = "&".join(["%s=%s" % i for i in list({
646+
"MAP": urllib.quote(self.projectPath),
647+
"SERVICE": "WMS",
648+
"VERSION": "1.1.1",
649+
"REQUEST": "GetPrint",
650+
"TEMPLATE": "layoutA4",
651+
"FORMAT": "png",
652+
"map0:EXTENT": "-33626185.498,-13032965.185,33978427.737,16020257.031",
653+
"map0:LAYERS": "Hello,Country", # inverted
654+
"map0:ROTATION": "45",
655+
"HEIGHT": "500",
656+
"WIDTH": "500",
657+
"CRS": "EPSG:3857"
658+
}.items())])
659+
660+
r, h = self._result(self.server.handleRequest(qs))
661+
self._img_diff_error(r, h, "WMS_GetPrint_Rotation")
662+
663+
def test_wms_getprint_selection(self):
664+
qs = "&".join(["%s=%s" % i for i in list({
665+
"MAP": urllib.quote(self.projectPath),
666+
"SERVICE": "WMS",
667+
"VERSION": "1.1.1",
668+
"REQUEST": "GetPrint",
669+
"TEMPLATE": "layoutA4",
670+
"FORMAT": "png",
671+
"map0:EXTENT": "-33626185.498,-13032965.185,33978427.737,16020257.031",
672+
"map0:LAYERS": "Hello,Country", # inverted
673+
"HEIGHT": "500",
674+
"WIDTH": "500",
675+
"CRS": "EPSG:3857",
676+
"SELECTION": "Country: 4"
677+
}.items())])
678+
679+
r, h = self._result(self.server.handleRequest(qs))
680+
self._img_diff_error(r, h, "WMS_GetPrint_Selection")
681+
365682
def test_getLegendGraphics(self):
366683
"""Test that does not return an exception but an image"""
367684
parms = {
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

‎tests/testdata/qgis_server_accesscontrol/project.qgs

Lines changed: 676 additions & 9 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.