diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2013-03-02 16:57:00 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2013-03-02 16:57:00 +1300 |
commit | 155710f9912f0a7370deab2bef6ad0a51ce47f2b (patch) | |
tree | 34993c7582e43fabe17500f752f935d3f83c80c0 /test/test_pathoc.py | |
parent | 9167b9b8b6f9235f4d4c5c3cf838dd7927a10116 (diff) | |
download | mitmproxy-155710f9912f0a7370deab2bef6ad0a51ce47f2b.tar.gz mitmproxy-155710f9912f0a7370deab2bef6ad0a51ce47f2b.tar.bz2 mitmproxy-155710f9912f0a7370deab2bef6ad0a51ce47f2b.zip |
Improve robustness of proxy CONNECT, test coverage to 100%.
Diffstat (limited to 'test/test_pathoc.py')
-rw-r--r-- | test/test_pathoc.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/test_pathoc.py b/test/test_pathoc.py index 52a1b5ee..5391167f 100644 --- a/test/test_pathoc.py +++ b/test/test_pathoc.py @@ -2,6 +2,10 @@ import json, cStringIO from libpathod import pathoc, test, version import tutils +def test_response(): + r = pathoc.Response("1.1", 200, "Message", {}, None) + assert repr(r) + class _TestDaemon: @classmethod @@ -126,3 +130,19 @@ class TestDaemon(_TestDaemon): assert "foo" in self.tval(["+%s"%d], showreq=True) assert "File" in self.tval(["+/nonexistent"]) + def test_connect_fail(self): + to = ("foobar", 80) + c = pathoc.Pathoc("127.0.0.1", self.d.port) + r, w = cStringIO.StringIO(), cStringIO.StringIO() + tutils.raises("connect failed", c.http_connect, to, w, r) + r = cStringIO.StringIO( + "HTTP/1.1 500 OK\r\n" + ) + tutils.raises("connect failed", c.http_connect, to, w, r) + r = cStringIO.StringIO( + "HTTP/1.1 200 OK\r\n" + ) + c.http_connect(to, w, r) + + + |