aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_log.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2015-06-04 20:36:50 +1200
committerAldo Cortesi <aldo@nullcube.com>2015-06-04 20:36:50 +1200
commit07d5b90ebf190c4419f6b3f3d3cea1cf116ceecb (patch)
tree3a27d3c3e0b4985368fcd3a8153924c497162fbd /test/test_log.py
parent182b79ab9ec3f59e17536b135e90eaa91e577111 (diff)
downloadmitmproxy-07d5b90ebf190c4419f6b3f3d3cea1cf116ceecb.tar.gz
mitmproxy-07d5b90ebf190c4419f6b3f3d3cea1cf116ceecb.tar.bz2
mitmproxy-07d5b90ebf190c4419f6b3f3d3cea1cf116ceecb.zip
Shore up test suite.
Diffstat (limited to 'test/test_log.py')
-rw-r--r--test/test_log.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/test_log.py b/test/test_log.py
new file mode 100644
index 00000000..5473236e
--- /dev/null
+++ b/test/test_log.py
@@ -0,0 +1,22 @@
+import StringIO
+from libpathod import log
+import netlib.tcp
+
+
+class DummyIO(StringIO.StringIO):
+ def start_log(self, *args, **kwargs):
+ pass
+
+ def get_log(self, *args, **kwargs):
+ return ""
+
+
+def test_disconnect():
+ outf = DummyIO()
+ rw = DummyIO()
+ try:
+ with log.Log(outf, False, rw, rw) as lg:
+ raise netlib.tcp.NetLibDisconnect()
+ except netlib.tcp.NetLibDisconnect:
+ pass
+ assert "Disconnected" in outf.getvalue()