diff options
author | Thomas Kriechbaumer <Kriechi@users.noreply.github.com> | 2017-02-24 22:39:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-24 22:39:16 +0100 |
commit | ccd8e1e617cdbf3b34ec01ac130093396197101f (patch) | |
tree | 6abce6e6f5e0cd04d48d639773e2772d791df7bd | |
parent | 3c66eb5b4bb3d116f17d94146e46d6dea87218fb (diff) | |
download | mitmproxy-ccd8e1e617cdbf3b34ec01ac130093396197101f.tar.gz mitmproxy-ccd8e1e617cdbf3b34ec01ac130093396197101f.tar.bz2 mitmproxy-ccd8e1e617cdbf3b34ec01ac130093396197101f.zip |
http: coverage++ (#2060)
-rw-r--r-- | setup.cfg | 2 | ||||
-rw-r--r-- | test/mitmproxy/test_http.py | 25 |
2 files changed, 25 insertions, 2 deletions
@@ -39,7 +39,6 @@ exclude = mitmproxy/controller.py mitmproxy/export.py mitmproxy/flow.py - mitmproxy/http.py mitmproxy/io_compat.py mitmproxy/master.py mitmproxy/optmanager.py @@ -63,7 +62,6 @@ exclude = mitmproxy/exceptions.py mitmproxy/export.py mitmproxy/flow.py - mitmproxy/http.py mitmproxy/io.py mitmproxy/io_compat.py mitmproxy/log.py diff --git a/test/mitmproxy/test_http.py b/test/mitmproxy/test_http.py index 2423535d..889eb0a7 100644 --- a/test/mitmproxy/test_http.py +++ b/test/mitmproxy/test_http.py @@ -21,6 +21,7 @@ class TestHTTPRequest: assert r.url == u r2 = r.copy() assert r.get_state() == r2.get_state() + assert hash(r) def test_get_url(self): r = http.HTTPRequest.wrap(mitmproxy.test.tutils.treq()) @@ -95,6 +96,7 @@ class TestHTTPFlow: def test_copy(self): f = tflow.tflow(resp=True) + assert repr(f) f.get_state() f2 = f.copy() a = f.get_state() @@ -229,3 +231,26 @@ class TestHTTPFlow: assert f.response.raw_content != b"abarb" f.response.decode() assert f.response.raw_content == b"abarb" + + +def test_make_error_response(): + resp = http.make_error_response(543, 'foobar', Headers()) + assert resp + + +def test_make_connect_request(): + req = http.make_connect_request(('invalidhost', 1234)) + assert req.first_line_format == 'authority' + assert req.method == 'CONNECT' + assert req.http_version == 'HTTP/1.1' + + +def test_make_connect_response(): + resp = http.make_connect_response('foobar') + assert resp.http_version == 'foobar' + assert resp.status_code == 200 + + +def test_expect_continue_response(): + assert http.expect_continue_response.http_version == 'HTTP/1.1' + assert http.expect_continue_response.status_code == 100 |