From 923503260ed48510da63e4dd1d6b36b4b859b110 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Fri, 10 Apr 2015 19:42:32 +0200 Subject: add tests --- test/test_protocol_http.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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") -- cgit v1.2.3