def testFetchSSLRequest(self): real_dns_lookup = dnsproxy.RealDnsLookup( name_servers=[platformsettings.get_original_primary_nameserver()]) fetch = httpclient.RealHttpFetch(real_dns_lookup) request = httparchive.ArchivedHttpRequest( command='GET', host='google.com', full_path='/search?q=dogs', request_body=None, headers={}, is_ssl=True) response = fetch(request) self.assertIsNotNone(response)
def setUp(self): def real_dns_lookup(host): return { 'example.com': '127.127.127.127', 'proxy.com': '2.2.2.2', }[host] self.fetch = httpclient.RealHttpFetch(real_dns_lookup) self.https_proxy = None self.http_proxy = None def get_proxy(is_ssl): return self.https_proxy if is_ssl else self.http_proxy self.fetch._get_system_proxy = get_proxy