aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2013-02-24 17:35:24 +1300
committerAldo Cortesi <aldo@nullcube.com>2013-02-24 17:35:24 +1300
commit705559d65e5dc5883395efb85bacbf1459eb243c (patch)
tree2fb5143c73753b8541a47fb8ca20d10e96438bf6 /test
parentd0639e8925541bd6f6f386386c982d23b3828d3d (diff)
downloadmitmproxy-705559d65e5dc5883395efb85bacbf1459eb243c.tar.gz
mitmproxy-705559d65e5dc5883395efb85bacbf1459eb243c.tar.bz2
mitmproxy-705559d65e5dc5883395efb85bacbf1459eb243c.zip
Refactor to prepare for SNI fixes.
Diffstat (limited to 'test')
-rw-r--r--test/test_proxy.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/test_proxy.py b/test/test_proxy.py
index bdac8697..b575a1d0 100644
--- a/test/test_proxy.py
+++ b/test/test_proxy.py
@@ -40,7 +40,7 @@ class TestServerConnection:
def test_simple(self):
sc = proxy.ServerConnection(proxy.ProxyConfig(), self.d.IFACE, self.d.port)
- sc.connect("http")
+ sc.connect("http", "host.com")
r = tutils.treq()
r.path = "/p/200:da"
sc.send(r)
@@ -54,7 +54,7 @@ class TestServerConnection:
def test_terminate_error(self):
sc = proxy.ServerConnection(proxy.ProxyConfig(), self.d.IFACE, self.d.port)
- sc.connect("http")
+ sc.connect("http", "host.com")
sc.connection = mock.Mock()
sc.connection.close = mock.Mock(side_effect=IOError)
sc.terminate()
@@ -75,14 +75,14 @@ class TestServerConnectionPool:
@mock.patch("libmproxy.proxy.ServerConnection", _dummysc)
def test_pooling(self):
p = proxy.ServerConnectionPool(proxy.ProxyConfig())
- c = p.get_connection("http", "localhost", 80)
- c2 = p.get_connection("http", "localhost", 80)
+ c = p.get_connection("http", "localhost", 80, "localhost")
+ c2 = p.get_connection("http", "localhost", 80, "localhost")
assert c is c2
- c3 = p.get_connection("http", "foo", 80)
+ c3 = p.get_connection("http", "foo", 80, "localhost")
assert not c is c3
@mock.patch("libmproxy.proxy.ServerConnection", _errsc)
def test_connection_error(self):
p = proxy.ServerConnectionPool(proxy.ProxyConfig())
- tutils.raises("502", p.get_connection, "http", "localhost", 80)
+ tutils.raises("502", p.get_connection, "http", "localhost", 80, "localhost")