From: Lee Kyoung chan Date: Thu, 11 Sep 2014 13:16:44 +0000 (+0900) Subject: Added a unit test for setting a cookie with max_age X-Git-Tag: v4.1.0b1~93^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1179%2Fhead;p=thirdparty%2Ftornado.git Added a unit test for setting a cookie with max_age --- diff --git a/tornado/test/web_test.py b/tornado/test/web_test.py index 1ad3794cb..6593cbb4c 100644 --- a/tornado/test/web_test.py +++ b/tornado/test/web_test.py @@ -163,11 +163,16 @@ class CookieTest(WebTestCase): # Attributes from the first call are not carried over. self.set_cookie("a", "e") + class SetCookieMaxAgeHandler(RequestHandler): + def get(self): + self.set_cookie("foo", "bar", max_age=10) + return [("/set", SetCookieHandler), ("/get", GetCookieHandler), ("/set_domain", SetCookieDomainHandler), ("/special_char", SetCookieSpecialCharHandler), ("/set_overwrite", SetCookieOverwriteHandler), + ("/set_max_age", SetCookieMaxAgeHandler), ] def test_set_cookie(self): @@ -222,6 +227,12 @@ class CookieTest(WebTestCase): self.assertEqual(sorted(headers), ["a=e; Path=/", "c=d; Domain=example.com; Path=/"]) + def test_set_cookie_max_age(self): + response = self.fetch("/set_max_age") + headers = response.headers.get_list("Set-Cookie") + self.assertEqual(sorted(headers), + ["foo=bar; Max-Age=10; Path=/"]) + class AuthRedirectRequestHandler(RequestHandler): def initialize(self, login_url):