def test_get_opener_with_proxy(getenv): "get_opener() Should return a Proxy Manager from urllib3 when `http_proxy` is available" # Given the following proxy server set in the http_proxy variable getenv.return_value = 'http://*****:*****@srv.prx:8123' # When I request the opener opener = downloader.get_opener() # Then I get a Proxy Manager opener.should.be.a(urllib3.ProxyManager) # And I check that the proxy URL is right '{0}://{1}@{2}:{3}'.format(*tuple(opener.proxy)).should.equal('http://*****:*****@srv.prx:8123') # And that the authentication header is present opener.proxy_headers.should.equal( {'proxy-authorization': 'Basic dXNlcjpwd2Q='})
def test_get_opener_with_proxy(getenv): "get_opener() Should return a Proxy Manager from urllib3 when `http_proxy` is available" # Given the following proxy server set in the http_proxy variable getenv.return_value = 'http://*****:*****@srv.prx:8123' # When I request the opener opener = downloader.get_opener() # Then I get a Proxy Manager opener.should.be.a(urllib3.ProxyManager) # And I check that the proxy URL is right '{0}://{1}@{2}:{3}'.format( *tuple(opener.proxy)).should.equal('http://*****:*****@srv.prx:8123') # And that the authentication header is present opener.proxy_headers.should.equal( {'proxy-authorization': 'Basic dXNlcjpwd2Q='})
def test_get_opener(): "get_opener() Should return an HTTP retriever class from urllib3" # When I need a regular opener; Then I should get a Pool Manager downloader.get_opener().should.be.a(urllib3.PoolManager)