aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2013-01-28 21:59:03 +1300
committerAldo Cortesi <aldo@nullcube.com>2013-01-28 21:59:03 +1300
commit57f01ffb07a7f32fa9679787e8894cf4917b022b (patch)
treec01dc6ae80fa36d4ba7faa628abb06406b31be83 /test
parent1e0bab65e3131829560383d147a192e0912c2fe9 (diff)
downloadmitmproxy-57f01ffb07a7f32fa9679787e8894cf4917b022b.tar.gz
mitmproxy-57f01ffb07a7f32fa9679787e8894cf4917b022b.tar.bz2
mitmproxy-57f01ffb07a7f32fa9679787e8894cf4917b022b.zip
Test suite, remove extraneous code.
Diffstat (limited to 'test')
-rw-r--r--test/test_proxy.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/test_proxy.py b/test/test_proxy.py
index 89e5a825..c73f61d8 100644
--- a/test/test_proxy.py
+++ b/test/test_proxy.py
@@ -2,6 +2,7 @@ from libmproxy import proxy, flow
import tutils
from libpathod import test
from netlib import http
+import mock
def test_proxy_error():
@@ -30,7 +31,6 @@ def test_app_registry():
assert ar.get(r)
-
class TestServerConnection:
def setUp(self):
self.d = test.Daemon()
@@ -50,9 +50,11 @@ class TestServerConnection:
r.content = flow.CONTENT_MISSING
tutils.raises("incomplete request", sc.send, r)
- def test_send_error(self):
+ sc.terminate()
+
+ def test_terminate_error(self):
sc = proxy.ServerConnection(proxy.ProxyConfig(), self.d.IFACE, self.d.port)
sc.connect("http")
- r = tutils.treq()
- sc.send(r)
-
+ sc.connection = mock.Mock()
+ sc.connection.close = mock.Mock(side_effect=IOError)
+ sc.terminate()