diff options
author | Thomas Kriechbaumer <Kriechi@users.noreply.github.com> | 2016-04-03 10:16:39 +0200 |
---|---|---|
committer | Thomas Kriechbaumer <Kriechi@users.noreply.github.com> | 2016-04-03 10:16:39 +0200 |
commit | f5fe93bf1317fef0039e5b74e6c0812c78942db8 (patch) | |
tree | a58423514fd1759580ab89f4ddb6b795bbc3a461 /test/netlib/http/test_cookies.py | |
parent | 16fdbb4f2fcee8f1db4a516d173ec2881161b3ea (diff) | |
parent | 4e2acc4d9d453126ac0e8aa20f3cb7dcc6a85a8c (diff) | |
download | mitmproxy-f5fe93bf1317fef0039e5b74e6c0812c78942db8.tar.gz mitmproxy-f5fe93bf1317fef0039e5b74e6c0812c78942db8.tar.bz2 mitmproxy-f5fe93bf1317fef0039e5b74e6c0812c78942db8.zip |
Merge pull request #1074 from mitmproxy/move-response-refresh
move HTTPResponse.refresh into netlib
Diffstat (limited to 'test/netlib/http/test_cookies.py')
-rw-r--r-- | test/netlib/http/test_cookies.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/netlib/http/test_cookies.py b/test/netlib/http/test_cookies.py index 34bb64f2..3b520a44 100644 --- a/test/netlib/http/test_cookies.py +++ b/test/netlib/http/test_cookies.py @@ -1,4 +1,5 @@ from netlib.http import cookies +from netlib.tutils import raises def test_read_token(): @@ -216,3 +217,18 @@ def test_parse_set_cookie_header(): assert ret2[2].lst == expected[2] else: assert ret is None + + +def test_refresh_cookie(): + + # Invalid expires format, sent to us by Reddit. + c = "rfoo=bar; Domain=reddit.com; expires=Thu, 31 Dec 2037 23:59:59 GMT; Path=/" + assert cookies.refresh_set_cookie_header(c, 60) + + 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) + + # https://github.com/mitmproxy/mitmproxy/issues/773 + c = ">=A" + with raises(ValueError): + cookies.refresh_set_cookie_header(c, 60)
\ No newline at end of file |