diff options
Diffstat (limited to 'test/netlib')
-rw-r--r-- | test/netlib/http/test_cookies.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/netlib/http/test_cookies.py b/test/netlib/http/test_cookies.py index 17e21b94..5a0e264e 100644 --- a/test/netlib/http/test_cookies.py +++ b/test/netlib/http/test_cookies.py @@ -266,3 +266,23 @@ def test_is_expired(): assert not cookies.is_expired(CA([("Max-Age", "nan")])) assert not cookies.is_expired(CA([("Expires", "false")])) + + +def test_group_cookies(): + def group(cookie): + return cookies.group_cookies(cookies.parse_cookie_header(c)) + + c = "one=uno; foo=bar; foo=baz" + assert len(group(c)) == 3 + + c = "one=uno; Path=/; foo=bar; Max-Age=0; foo=baz; expires=24-08-1993" + assert len(group(c)) == 3 + + c = "one=uno;" + assert len(group(c)) == 1 + + c = "one=uno; Path=/; Max-Age=0; Expires=24-08-1993" + assert len(group(c)) == 1 + + c = "path=val; Path=/" + assert group(c) == [("path", "val", cookies.CookieAttrs([("Path", "/")]))] |