How to use get_provider method in localstack

Best Python code snippet using localstack_python

test_tile_providers.py

Source:test_tile_providers.py Github

copy

Full Screen

...70 def test_type(self, name) -> None:71 p = getattr(bt, name)72 assert isinstance(p, str)73 def test_url(self, name) -> None:74 p = bt.get_provider(getattr(bt, name))75 assert p.url == _STAMEN_URLS[name]76 def test_attribution(self, name) -> None:77 p = bt.get_provider(getattr(bt, name))78 assert p.attribution == (79 'Map tiles by <a href="https://stamen.com">Stamen Design</a>, '80 'under <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. '81 'Data by <a href="https://openstreetmap.org">OpenStreetMap</a>, '82 'under %s.'83 ) % _STAMEN_LIC[name]84 def test_copies(self, name) -> None:85 p1 = bt.get_provider(getattr(bt, name))86 p2 = bt.get_provider(getattr(bt, name))87 assert p1 is not p288@pytest.mark.parametrize('name', ['CARTODBPOSITRON', 'CARTODBPOSITRON_RETINA'])89class Test_CartoProviders(object):90 def test_type(self, name) -> None:91 p = getattr(bt, name)92 assert isinstance(p, str)93 def test_url(self, name) -> None:94 p = bt.get_provider(getattr(bt, name))95 assert p.url == _CARTO_URLS[name]96 def test_attribution(self, name) -> None:97 p = bt.get_provider(getattr(bt, name))98 assert p.attribution == (99 '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors,'100 '&copy; <a href="https://cartodb.com/attributions">CartoDB</a>'101 )102 def test_copies(self, name) -> None:103 p1 = bt.get_provider(getattr(bt, name))104 p2 = bt.get_provider(getattr(bt, name))105 assert p1 is not p2106@pytest.mark.parametrize('name', ['OSM'])107class Test_OsmProvider(object):108 def test_type(self, name) -> None:109 p = getattr(bt, name)110 assert isinstance(p, str)111 def test_url(self, name) -> None:112 p = bt.get_provider(getattr(bt, name))113 assert p.url == _OSM_URLS[name]114 def test_attribution(self, name) -> None:115 p = bt.get_provider(getattr(bt, name))116 assert p.attribution == (117 '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'118 )119 def test_copies(self, name) -> None:120 p1 = bt.get_provider(getattr(bt, name))121 p2 = bt.get_provider(getattr(bt, name))122 assert p1 is not p2123@pytest.mark.parametrize('name', ['WIKIMEDIA'])124class Test_WikimediaProvider(object):125 def test_type(self, name) -> None:126 p = getattr(bt, name)127 assert isinstance(p, str)128 def test_url(self, name) -> None:129 p = bt.get_provider(getattr(bt, name))130 assert p.url == _WIKIMEDIA_URLS[name]131 def test_attribution(self, name) -> None:132 p = bt.get_provider(getattr(bt, name))133 assert p.attribution == (134 '&copy; <a href="https://foundation.wikimedia.org/wiki/Maps_Terms_of_Use">Wikimedia Maps</a> contributors'135 )136 def test_copies(self, name) -> None:137 p1 = bt.get_provider(getattr(bt, name))138 p2 = bt.get_provider(getattr(bt, name))139 assert p1 is not p2140@pytest.mark.parametrize('name', ['ESRI_IMAGERY'])141class Test_EsriProvider(object):142 def test_type(self, name) -> None:143 p = getattr(bt, name)144 assert isinstance(p, str)145 def test_url(self, name) -> None:146 p = bt.get_provider(getattr(bt, name))147 assert p.url == _ESRI_URLS[name]148 def test_attribution(self, name) -> None:149 p = bt.get_provider(getattr(bt, name))150 assert p.attribution == (151 '&copy; <a href="http://downloads.esri.com/ArcGISOnline/docs/tou_summary.pdf">Esri</a>, '152 'Earthstar Geographics'153 )154 def test_copies(self, name) -> None:155 p1 = bt.get_provider(getattr(bt, name))156 p2 = bt.get_provider(getattr(bt, name))157 assert p1 is not p2158class Test_GetProvider(object):159 @pytest.mark.parametrize('name', ['CARTODBPOSITRON', 'CARTODBPOSITRON_RETINA', 'STAMEN_TERRAIN',160 'STAMEN_TERRAIN_RETINA', 'STAMEN_TONER', 'STAMEN_TONER_BACKGROUND',161 'STAMEN_TONER_LABELS', 'OSM', 'WIKIMEDIA', 'ESRI_IMAGERY', ])162 def test_get_provider(self, name) -> None:163 assert name in bt.Vendors164 enum_member = getattr(bt.Vendors, name)165 assert hasattr(bt, name)166 mod_member = getattr(bt, name)167 p1 = bt.get_provider(enum_member)168 p2 = bt.get_provider(name)169 p3 = bt.get_provider(name.lower())170 p4 = bt.get_provider(mod_member)171 assert isinstance(p1, WMTSTileSource)172 assert isinstance(p2, WMTSTileSource)173 assert isinstance(p3, WMTSTileSource)174 assert isinstance(p4, WMTSTileSource)175 assert p1 is not p2176 assert p2 is not p3177 assert p2 is not p4178 assert p4 is not p1179 assert p1.url == p2.url == p3.url == p4.url180 assert p1.attribution == p2.attribution == p3.attribution == p4.attribution181 def test_unknown_vendor(self) -> None:182 with pytest.raises(ValueError):183 bt.get_provider("This is not a valid tile vendor")184#-----------------------------------------------------------------------------185# Dev API186#-----------------------------------------------------------------------------187#-----------------------------------------------------------------------------188# Private API189#-----------------------------------------------------------------------------190#-----------------------------------------------------------------------------191# Code...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful