diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-04-10 19:42:32 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-04-10 19:42:32 +0200 |
commit | 923503260ed48510da63e4dd1d6b36b4b859b110 (patch) | |
tree | b8180e1f34b071825b6aa0017fc73f482d4270a3 | |
parent | ab2b98b988e6ec76d2c0f79dfe52d9ff4096619c (diff) | |
download | mitmproxy-923503260ed48510da63e4dd1d6b36b4b859b110.tar.gz mitmproxy-923503260ed48510da63e4dd1d6b36b4b859b110.tar.bz2 mitmproxy-923503260ed48510da63e4dd1d6b36b4b859b110.zip |
add tests
-rw-r--r-- | test/test_protocol_http.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test_protocol_http.py b/test/test_protocol_http.py index c6fad508..e3593ae3 100644 --- a/test/test_protocol_http.py +++ b/test/test_protocol_http.py @@ -121,6 +121,20 @@ class TestHTTPRequest: r = tutils.treq() assert repr(r) + def test_pretty_host(self): + r = tutils.treq() + assert r.pretty_host(True) == "address" + assert r.pretty_host(False) == "address" + r.headers["host"] = ["other"] + assert r.pretty_host(True) == "other" + assert r.pretty_host(False) == "address" + r.host = None + assert r.pretty_host(True) == "other" + assert r.pretty_host(False) is None + del r.headers["host"] + assert r.pretty_host(True) is None + assert r.pretty_host(False) is None + def test_get_form_for_urlencoded(self): r = tutils.treq() r.headers.add("content-type", "application/x-www-form-urlencoded") |