@pytest.mark.parametrize('url, expected', (('hTTp://u:p@Some.Host/path', 'http://some.host.proxy'), ('hTTp://u:p@Other.Host/path', 'http://http.proxy'), ('hTTps://Other.Host', None), ('file:///etc/motd', None)))
def test_select_proxies(url, expected):
 proxies = {'http': 'http://http.proxy', 'http://some.host': 'http://some.host.proxy'}
 assert (select_proxy(url, proxies) == expected)

@ pytest . mark . parametrize ( 'url, expected' , ( ( 'hTTp://u:p@Some.Host/path' , 'http://some.host.proxy' ) , ( 'hTTp://u:p@Other.Host/path' , 'http://http.proxy' ) , ( 'hTTps://Other.Host' , None ) , ( 'file:///etc/motd' , None ) ) ) def test_select_proxies ( url , expected ) : proxies = { 'http' : 'http://http.proxy' , 'http://some.host' : 'http://some.host.proxy' } assert ( select_proxy ( url , proxies ) == expected )
make sure we can select per-host proxies correctly .