diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2016-06-07 12:56:51 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2016-06-07 12:56:51 +1200 |
commit | 75ebd638eb6f6ed74f1f191d4f9e30277f4f2d34 (patch) | |
tree | 9bff77b84d485549f2d9cfad61a4c54b6315088d /test/pathod/test_pathod.py | |
parent | e037fe05ff1f0c2893b3f51e06e0261ca4245d63 (diff) | |
parent | 80292c0ac3c9684ee945546c9b45334178518e4e (diff) | |
download | mitmproxy-75ebd638eb6f6ed74f1f191d4f9e30277f4f2d34.tar.gz mitmproxy-75ebd638eb6f6ed74f1f191d4f9e30277f4f2d34.tar.bz2 mitmproxy-75ebd638eb6f6ed74f1f191d4f9e30277f4f2d34.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'test/pathod/test_pathod.py')
-rw-r--r-- | test/pathod/test_pathod.py | 28 |
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"]) |