def test_mixed_sources(self):
        common_params = (r'?SERVICE=WMS&FORMAT=image%2Fpng'
                                  '&REQUEST=GetMap&HEIGHT=200&SRS=EPSG%3A4326&styles='
                                  '&VERSION=1.1.1&BBOX=9.0,50.0,10.0,51.0'
                                  '&WIDTH=200&transparent=True')

        expected_req = [({'path': '/service_a' + common_params + '&layers=a_one'},
                         {'body': transp, 'headers': {'content-type': 'image/png'}}),
                        ]

        with mock_httpd(('localhost', 42423), expected_req):
            self.common_map_req.params.layers = 'online,all_offline'
            resp = self.app.get(self.common_map_req)
            assert_no_cache(resp)
            eq_(resp.content_type, 'image/png')
            assert 0.99 > bgcolor_ratio(resp.body) > 0.95
Esempio n. 2
0
 def test_mixed_sources(self):
     common_params = (r'?SERVICE=WMS&FORMAT=image%2Fpng'
                               '&REQUEST=GetMap&HEIGHT=200&SRS=EPSG%3A4326&styles='
                               '&VERSION=1.1.1&BBOX=9.0,50.0,10.0,51.0'
                               '&WIDTH=200&transparent=True')
     
     expected_req = [({'path': '/service_a' + common_params + '&layers=a_one'},
                      {'body': transp, 'headers': {'content-type': 'image/png'}}),
                     ]
                      
     with mock_httpd(('localhost', 42423), expected_req):
         self.common_map_req.params.layers = 'online,all_offline'
         resp = self.app.get(self.common_map_req)
         assert_no_cache(resp)
         eq_(resp.content_type, 'image/png')
         assert 0.99 > bgcolor_ratio(resp.body) > 0.95
Esempio n. 3
0
    def test_mixed_layer_source(self, app):
        common_params = (r"?SERVICE=WMS&FORMAT=image%2Fpng"
                         "&REQUEST=GetMap&HEIGHT=200&SRS=EPSG%3A4326&styles="
                         "&VERSION=1.1.1&BBOX=9.0,50.0,10.0,51.0"
                         "&WIDTH=200&transparent=True")

        expected_req = [(
            {
                "path": "/service_a" + common_params + "&layers=a_one"
            },
            {
                "body": transp,
                "headers": {
                    "content-type": "image/png"
                }
            },
        )]

        with mock_httpd(("localhost", 42423), expected_req):
            self.common_map_req.params.layers = "mixed"
            resp = app.get(self.common_map_req)
            assert_no_cache(resp)
            assert resp.content_type == "image/png"
            assert 0.99 > bgcolor_ratio(resp.body) > 0.95