From f2a44528825ac07ca28c8bb7dc01b4375df8dc2c Mon Sep 17 00:00:00 2001 From: e0ne Date: Mon, 9 Sep 2013 12:40:37 +0300 Subject: Fixed #18403 -- Initialized bad_cookies in SimpleCookie Thanks Stefano Crosta for the report. --- tests/httpwrappers/tests.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py index 17bb98e24d..287d800c21 100644 --- a/tests/httpwrappers/tests.py +++ b/tests/httpwrappers/tests.py @@ -618,3 +618,12 @@ class CookieTests(unittest.TestCase): c = SimpleCookie() c.load({'name': 'val'}) self.assertEqual(c['name'].value, 'val') + + @unittest.skipUnless(six.PY2, "PY3 throws an exception on invalid cookie keys.") + def test_bad_cookie(self): + """ + Regression test for #18403 + """ + r = HttpResponse() + r.set_cookie("a:.b/", 1) + self.assertEqual(len(r.cookies.bad_cookies), 1) -- cgit v1.3