aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUjjwal Verma <ujjwalverma1111@gmail.com>2017-05-09 18:42:05 +0530
committerUjjwal Verma <ujjwalverma1111@gmail.com>2017-05-12 21:09:50 +0530
commit766c5caea87d49f8fa2d807f6d954ca68e086231 (patch)
tree0b4eb6bc03d1a8656cd6d0f9ece67971350b4101
parent9f8e83259ec0689cd8e14268584ef589e8de6840 (diff)
downloadmitmproxy-766c5caea87d49f8fa2d807f6d954ca68e086231.tar.gz
mitmproxy-766c5caea87d49f8fa2d807f6d954ca68e086231.tar.bz2
mitmproxy-766c5caea87d49f8fa2d807f6d954ca68e086231.zip
Increased net.http.cookies.py and net.http.message.py coverage
-rw-r--r--test/mitmproxy/net/http/test_cookies.py3
-rw-r--r--test/mitmproxy/net/http/test_message.py6
2 files changed, 9 insertions, 0 deletions
diff --git a/test/mitmproxy/net/http/test_cookies.py b/test/mitmproxy/net/http/test_cookies.py
index 680a5033..77549d9e 100644
--- a/test/mitmproxy/net/http/test_cookies.py
+++ b/test/mitmproxy/net/http/test_cookies.py
@@ -269,6 +269,9 @@ def test_refresh_cookie():
c = "MOO=BAR; Expires=Tue, 08-Mar-2011 00:20:38 GMT; Path=foo.com; Secure"
assert "00:21:38" in cookies.refresh_set_cookie_header(c, 60)
+ c = "rfoo=bar; Domain=reddit.com; expires=Thu, 31 Dec 2037; Path=/"
+ assert "expires" not in cookies.refresh_set_cookie_header(c, 60)
+
c = "foo,bar"
with pytest.raises(ValueError):
cookies.refresh_set_cookie_header(c, 60)
diff --git a/test/mitmproxy/net/http/test_message.py b/test/mitmproxy/net/http/test_message.py
index c6036697..512f3199 100644
--- a/test/mitmproxy/net/http/test_message.py
+++ b/test/mitmproxy/net/http/test_message.py
@@ -48,6 +48,12 @@ class TestMessageData:
assert data != 0
+ def test_serializable(self):
+ data1 = tutils.tresp(timestamp_start=42, timestamp_end=42).data
+ data2 = tutils.tresp().data.from_state(data1.get_state()) # ResponseData.from_state()
+
+ assert data1 == data2
+
class TestMessage: