From 766c5caea87d49f8fa2d807f6d954ca68e086231 Mon Sep 17 00:00:00 2001 From: Ujjwal Verma Date: Tue, 9 May 2017 18:42:05 +0530 Subject: [PATCH] Increased net.http.cookies.py and net.http.message.py coverage --- test/mitmproxy/net/http/test_cookies.py | 3 +++ test/mitmproxy/net/http/test_message.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/test/mitmproxy/net/http/test_cookies.py b/test/mitmproxy/net/http/test_cookies.py index 680a50336..77549d9e6 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 c60366975..512f31991 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: