diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2013-01-05 19:44:12 -0800 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2013-01-05 19:44:12 -0800 |
commit | d0ee4d60d09c607a208ae1b190e619a4f106538e (patch) | |
tree | d61b69df2c120f1100e9639072f3b1d8d2231558 /test/test_server.py | |
parent | 060e3198bca48f327984b2d1d73a5d4592866736 (diff) | |
download | mitmproxy-d0ee4d60d09c607a208ae1b190e619a4f106538e.tar.gz mitmproxy-d0ee4d60d09c607a208ae1b190e619a4f106538e.tar.bz2 mitmproxy-d0ee4d60d09c607a208ae1b190e619a4f106538e.zip |
Unit tests and minor code refactoring for ServerConnection.
Diffstat (limited to 'test/test_server.py')
-rw-r--r-- | test/test_server.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/test/test_server.py b/test/test_server.py index 38d33d90..ba263e96 100644 --- a/test/test_server.py +++ b/test/test_server.py @@ -1,4 +1,5 @@ from netlib import tcp +from libpathod import pathoc import tutils """ @@ -52,6 +53,20 @@ class TestHTTP(tutils.HTTPProxTest, SanityMixin): t.wfile.flush() assert "Bad Request" in t.rfile.readline() + def test_upstream_ssl_error(self): + p = self.pathoc() + ret = p.request("get:'https://localhost:%s/'"%self.server.port) + assert ret[1] == 400 + + def test_http(self): + f = self.pathod("304") + assert f.status_code == 304 + + l = self.master.state.view[0] + assert l.request.client_conn.address + assert "host" in l.request.headers + assert l.response.code == 304 + class TestHTTPS(tutils.HTTPProxTest, SanityMixin): ssl = True @@ -65,12 +80,3 @@ class TestTransparent(tutils.TransparentProxTest, SanityMixin): transparent = True -class TestProxy(tutils.HTTPProxTest): - def test_http(self): - f = self.pathod("304") - assert f.status_code == 304 - - l = self.master.state.view[0] - assert l.request.client_conn.address - assert "host" in l.request.headers - assert l.response.code == 304 |