From 06f689aa34f43d2ce8fc85a6bc9831ae4ca7c69e Mon Sep 17 00:00:00 2001 From: kira0204 Date: Sun, 11 Feb 2018 17:25:44 +0530 Subject: keeping consistency, better testing --- test/mitmproxy/net/http/test_cookies.py | 26 +++++++++++++++++++++----- test/mitmproxy/net/http/test_response.py | 2 +- 2 files changed, 22 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/mitmproxy/net/http/test_cookies.py b/test/mitmproxy/net/http/test_cookies.py index 496f595b..e12b0f00 100644 --- a/test/mitmproxy/net/http/test_cookies.py +++ b/test/mitmproxy/net/http/test_cookies.py @@ -20,7 +20,7 @@ cookie_pairs = [ ], [ "one", - [["one", None]] + [["one", ""]] ], [ "one=uno; two=due", @@ -40,7 +40,7 @@ cookie_pairs = [ ], [ "one=uno; two; three=tre", - [["one", "uno"], ["two", None], ["three", "tre"]] + [["one", "uno"], ["two", ""], ["three", "tre"]] ], [ "_lvs2=zHai1+Hq+Tc2vmc2r4GAbdOI5Jopg3EwsdUT9g=; " @@ -82,9 +82,13 @@ def test_read_quoted_string(): def test_read_cookie_pairs(): vals = [ + [ + "=uno", + [["", "uno"]] + ], [ "one", - [["one", None]] + [["one", ""]] ], [ "one=two", @@ -104,7 +108,7 @@ def test_read_cookie_pairs(): ], [ 'one="two"; three=four; five', - [["one", "two"], ["three", "four"], ["five", None]] + [["one", "two"], ["three", "four"], ["five", ""]] ], [ 'one="\\"two"; three=four', @@ -138,6 +142,12 @@ def test_cookie_roundtrips(): def test_parse_set_cookie_pairs(): pairs = [ + [ + "=uno", + [[ + ["", "uno"] + ]] + ], [ "one=uno", [[ @@ -154,7 +164,7 @@ def test_parse_set_cookie_pairs(): "one=uno; foo", [[ ["one", "uno"], - ["foo", None] + ["foo", ""] ]] ], [ @@ -203,6 +213,12 @@ def test_parse_set_cookie_header(): [ ";", [] ], + [ + "=uno", + [ + ("", "uno", ()) + ] + ], [ "one=uno", [ diff --git a/test/mitmproxy/net/http/test_response.py b/test/mitmproxy/net/http/test_response.py index af35bab3..f3470384 100644 --- a/test/mitmproxy/net/http/test_response.py +++ b/test/mitmproxy/net/http/test_response.py @@ -113,7 +113,7 @@ class TestResponseUtils: assert attrs["domain"] == "example.com" assert attrs["expires"] == "Wed Oct 21 16:29:41 2015" assert attrs["path"] == "/" - assert attrs["httponly"] is None + assert attrs["httponly"] == "" def test_get_cookies_no_value(self): resp = tresp() -- cgit v1.2.3