aboutsummaryrefslogtreecommitdiffstats
path: root/test/pathod/test_pathod.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-06-06 16:03:45 -0700
committerMaximilian Hils <git@maximilianhils.com>2016-06-06 16:03:45 -0700
commit80292c0ac3c9684ee945546c9b45334178518e4e (patch)
tree0efb5753586222901bd1876aaa890304d7ccd622 /test/pathod/test_pathod.py
parent3bf36854e722945eaea1fd4887e075764bbc7ca2 (diff)
downloadmitmproxy-80292c0ac3c9684ee945546c9b45334178518e4e.tar.gz
mitmproxy-80292c0ac3c9684ee945546c9b45334178518e4e.tar.bz2
mitmproxy-80292c0ac3c9684ee945546c9b45334178518e4e.zip
fix all pathod tests on Windows :tada:
Diffstat (limited to 'test/pathod/test_pathod.py')
-rw-r--r--test/pathod/test_pathod.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/test/pathod/test_pathod.py b/test/pathod/test_pathod.py
index 0bbad6c2..ed4ef49f 100644
--- a/test/pathod/test_pathod.py
+++ b/test/pathod/test_pathod.py
@@ -145,14 +145,14 @@ class CommonTests(tutils.DaemonTests):
def test_invalid_first_line(self):
c = tcp.TCPClient(("localhost", self.d.port))
- c.connect()
- if self.ssl:
- c.convert_to_ssl()
- c.wfile.write("foo\n\n\n")
- c.wfile.flush()
- l = self.d.last_log()
- assert l["type"] == "error"
- assert "foo" in l["msg"]
+ with c.connect():
+ if self.ssl:
+ c.convert_to_ssl()
+ c.wfile.write("foo\n\n\n")
+ c.wfile.flush()
+ l = self.d.last_log()
+ assert l["type"] == "error"
+ assert "foo" in l["msg"]
def test_invalid_content_length(self):
tutils.raises(
@@ -238,12 +238,12 @@ class TestDaemonSSL(CommonTests):
c = tcp.TCPClient(("localhost", self.d.port))
c.rbufsize = 0
c.wbufsize = 0
- c.connect()
- c.wfile.write("\0\0\0\0")
- tutils.raises(TlsException, c.convert_to_ssl)
- l = self.d.last_log()
- assert l["type"] == "error"
- assert "SSL" in l["msg"]
+ with c.connect():
+ c.wfile.write("\0\0\0\0")
+ tutils.raises(TlsException, c.convert_to_ssl)
+ l = self.d.last_log()
+ assert l["type"] == "error"
+ assert "SSL" in l["msg"]
def test_ssl_cipher(self):
r, _ = self.pathoc([r"get:/p/202"])