def test_mixed_params(self): layers = [ WMSSource( WMSClient(create_request({"url": "http://foo/", "layers": "a"}, {})) ), WMSSource( WMSClient(create_request({"url": "http://foo/", "layers": "b"}, {})) ), WMSSource( WMSClient(create_request({"url": "http://foo/", "layers": "c"}, {})) ), WMSSource( WMSClient(create_request({"url": "http://foo/", "layers": "d"}, {})) ), WMSSource( WMSClient(create_request({"url": "http://foo/", "layers": "e"}, {})) ), WMSSource( WMSClient(create_request({"url": "http://foo/", "layers": "f"}, {})) ), ] layers[0].supported_srs = ["EPSG:4326"] layers[1].supported_srs = ["EPSG:4326"] layers[2].supported_formats = ["image/png"] layers[3].supported_formats = ["image/png"] combined = combined_layers(layers, self.q) assert len(combined) == 3 assert combined[0].client.request_template.params.layers == ["a", "b"] assert combined[1].client.request_template.params.layers == ["c", "d"] assert combined[2].client.request_template.params.layers == ["e", "f"]
def test_mixed_hosts(self): layers = [ WMSSource( WMSClient(create_request({"url": "http://foo/", "layers": "a"}, {})) ), WMSSource( WMSClient(create_request({"url": "http://foo/", "layers": "b"}, {})) ), WMSSource( WMSClient(create_request({"url": "http://bar/", "layers": "c"}, {})) ), WMSSource( WMSClient(create_request({"url": "http://bar/", "layers": "d"}, {})) ), WMSSource( WMSClient(create_request({"url": "http://foo/", "layers": "e"}, {})) ), WMSSource( WMSClient(create_request({"url": "http://foo/", "layers": "f"}, {})) ), ] combined = combined_layers(layers, self.q) assert len(combined) == 3 assert combined[0].client.request_template.params.layers == ["a", "b"] assert combined[1].client.request_template.params.layers == ["c", "d"] assert combined[2].client.request_template.params.layers == ["e", "f"]
def test_same_source(self): layers = [ WMSSource(WMSClient(create_request({'url': 'http://foo/', 'layers': 'a'}, {}))), WMSSource(WMSClient(create_request({'url': 'http://foo/', 'layers': 'b'}, {}))), ] combined = combined_layers(layers, self.q) eq_(len(combined), 1) eq_(combined[0].client.request_template.params.layers, ['a', 'b'])
def test_same_source(self): layers = [ WMSSource( WMSClient(create_request({"url": "http://foo/", "layers": "a"}, {})) ), WMSSource( WMSClient(create_request({"url": "http://foo/", "layers": "b"}, {})) ), ] combined = combined_layers(layers, self.q) assert len(combined) == 1 assert combined[0].client.request_template.params.layers == ["a", "b"]
def test_mixed_params(self): layers = [ WMSSource( WMSClient( create_request({ 'url': 'http://foo/', 'layers': 'a' }, {}))), WMSSource( WMSClient( create_request({ 'url': 'http://foo/', 'layers': 'b' }, {}))), WMSSource( WMSClient( create_request({ 'url': 'http://foo/', 'layers': 'c' }, {}))), WMSSource( WMSClient( create_request({ 'url': 'http://foo/', 'layers': 'd' }, {}))), WMSSource( WMSClient( create_request({ 'url': 'http://foo/', 'layers': 'e' }, {}))), WMSSource( WMSClient( create_request({ 'url': 'http://foo/', 'layers': 'f' }, {}))), ] layers[0].supported_srs = ["EPSG:4326"] layers[1].supported_srs = ["EPSG:4326"] layers[2].supported_formats = ["image/png"] layers[3].supported_formats = ["image/png"] combined = combined_layers(layers, self.q) eq_(len(combined), 3) eq_(combined[0].client.request_template.params.layers, ['a', 'b']) eq_(combined[1].client.request_template.params.layers, ['c', 'd']) eq_(combined[2].client.request_template.params.layers, ['e', 'f'])
def test_mixed_hosts(self): layers = [ WMSSource(WMSClient(create_request({'url': 'http://foo/', 'layers': 'a'}, {}))), WMSSource(WMSClient(create_request({'url': 'http://foo/', 'layers': 'b'}, {}))), WMSSource(WMSClient(create_request({'url': 'http://bar/', 'layers': 'c'}, {}))), WMSSource(WMSClient(create_request({'url': 'http://bar/', 'layers': 'd'}, {}))), WMSSource(WMSClient(create_request({'url': 'http://foo/', 'layers': 'e'}, {}))), WMSSource(WMSClient(create_request({'url': 'http://foo/', 'layers': 'f'}, {}))), ] combined = combined_layers(layers, self.q) eq_(len(combined), 3) eq_(combined[0].client.request_template.params.layers, ['a', 'b']) eq_(combined[1].client.request_template.params.layers, ['c', 'd']) eq_(combined[2].client.request_template.params.layers, ['e', 'f'])
def test_same_source(self): layers = [ WMSSource( WMSClient( create_request({ 'url': 'http://foo/', 'layers': 'a' }, {}))), WMSSource( WMSClient( create_request({ 'url': 'http://foo/', 'layers': 'b' }, {}))), ] combined = combined_layers(layers, self.q) eq_(len(combined), 1) eq_(combined[0].client.request_template.params.layers, ['a', 'b'])
def test_mixed_hosts(self): layers = [ WMSSource( WMSClient( create_request({ 'url': 'http://foo/', 'layers': 'a' }, {}))), WMSSource( WMSClient( create_request({ 'url': 'http://foo/', 'layers': 'b' }, {}))), WMSSource( WMSClient( create_request({ 'url': 'http://bar/', 'layers': 'c' }, {}))), WMSSource( WMSClient( create_request({ 'url': 'http://bar/', 'layers': 'd' }, {}))), WMSSource( WMSClient( create_request({ 'url': 'http://foo/', 'layers': 'e' }, {}))), WMSSource( WMSClient( create_request({ 'url': 'http://foo/', 'layers': 'f' }, {}))), ] combined = combined_layers(layers, self.q) eq_(len(combined), 3) eq_(combined[0].client.request_template.params.layers, ['a', 'b']) eq_(combined[1].client.request_template.params.layers, ['c', 'd']) eq_(combined[2].client.request_template.params.layers, ['e', 'f'])
def test_mixed_params(self): layers = [ WMSSource(WMSClient(create_request({'url': 'http://foo/', 'layers': 'a'}, {}))), WMSSource(WMSClient(create_request({'url': 'http://foo/', 'layers': 'b'}, {}))), WMSSource(WMSClient(create_request({'url': 'http://foo/', 'layers': 'c'}, {}))), WMSSource(WMSClient(create_request({'url': 'http://foo/', 'layers': 'd'}, {}))), WMSSource(WMSClient(create_request({'url': 'http://foo/', 'layers': 'e'}, {}))), WMSSource(WMSClient(create_request({'url': 'http://foo/', 'layers': 'f'}, {}))), ] layers[0].supported_srs = ["EPSG:4326"] layers[1].supported_srs = ["EPSG:4326"] layers[2].supported_formats = ["image/png"] layers[3].supported_formats = ["image/png"] combined = combined_layers(layers, self.q) eq_(len(combined), 3) eq_(combined[0].client.request_template.params.layers, ['a', 'b']) eq_(combined[1].client.request_template.params.layers, ['c', 'd']) eq_(combined[2].client.request_template.params.layers, ['e', 'f'])
def test_empty(self): eq_(combined_layers([], self.q), [])
def test_empty(self): assert combined_layers([], self.q) == []