summaryrefslogtreecommitdiff
path: root/tests/regressiontests/requests/tests.py
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-11-26 13:30:50 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-11-26 13:30:50 +0000
commit78be884ea788835ad98ad433862a82cf192c3d4f (patch)
tree847a8e79b97f45de19f0c288e485a969237b3699 /tests/regressiontests/requests/tests.py
parentba21814583e5e3a4fafc4f5f34a26b6acdfb7590 (diff)
Fixed #3304 -- Added support for HTTPOnly cookies. Thanks to arvin for the suggestion, and rodolfo for the draft patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14707 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/requests/tests.py')
-rw-r--r--tests/regressiontests/requests/tests.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/regressiontests/requests/tests.py b/tests/regressiontests/requests/tests.py
index 0bba733795..b1d80fe30e 100644
--- a/tests/regressiontests/requests/tests.py
+++ b/tests/regressiontests/requests/tests.py
@@ -89,6 +89,15 @@ class RequestsTests(unittest.TestCase):
self.assertEqual(max_age_cookie['max-age'], 10)
self.assertEqual(max_age_cookie['expires'], cookie_date(time.time()+10))
+ def test_httponly_cookie(self):
+ response = HttpResponse()
+ response.set_cookie('example', httponly=True)
+ example_cookie = response.cookies['example']
+ # A compat cookie may be in use -- check that it has worked
+ # both as an output string, and using the cookie attributes
+ self.assertTrue('; httponly' in str(example_cookie))
+ self.assertTrue(example_cookie['httponly'])
+
def test_limited_stream(self):
# Read all of a limited stream
stream = LimitedStream(StringIO('test'), 2)