diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2011-03-14 14:05:14 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2011-03-14 14:05:14 +1300 |
commit | 2e70a0e44bb8f51e97b1c611d15d4e7d69791602 (patch) | |
tree | 2858e9fd9b61d19acc23a6525c84c0ed9636ff21 | |
parent | e35fd7126b5e82d9628185bbe6503e288600ff53 (diff) | |
download | mitmproxy-2e70a0e44bb8f51e97b1c611d15d4e7d69791602.tar.gz mitmproxy-2e70a0e44bb8f51e97b1c611d15d4e7d69791602.tar.bz2 mitmproxy-2e70a0e44bb8f51e97b1c611d15d4e7d69791602.zip |
Fix unit tests on OSX when a system proxy is configured.
-rw-r--r-- | test/test_server.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/test/test_server.py b/test/test_server.py index 3559248e..e9b61165 100644 --- a/test/test_server.py +++ b/test/test_server.py @@ -7,23 +7,26 @@ class uSanity(tutils.ProxTest): """ Just check that the HTTP server is running. """ - f = urllib.urlopen("http://127.0.0.1:%s"%tutils.HTTP_PORT) + f = urllib.urlopen("http://127.0.0.1:%s"%tutils.HTTP_PORT, proxies={}) assert f.read() def test_https(self): """ Just check that the HTTPS server is running. """ - f = urllib.urlopen("https://127.0.0.1:%s"%tutils.HTTPS_PORT) + f = urllib.urlopen("https://127.0.0.1:%s"%tutils.HTTPS_PORT, proxies={}) assert f.read() class uProxy(tutils.ProxTest): HOST = "127.0.0.1" def _get(self, host=HOST): + proxy_support = urllib2.ProxyHandler( + {"http" : "http://127.0.0.1:%s"%tutils.PROXL_PORT} + ) + opener = urllib2.build_opener(proxy_support) r = urllib2.Request("http://%s:%s"%(host, tutils.HTTP_PORT)) - r.set_proxy("127.0.0.1:%s"%tutils.PROXL_PORT, "http") - return urllib2.urlopen(r) + return opener.open(r) def _sget(self, host=HOST): proxy_support = urllib2.ProxyHandler( |