summaryrefslogtreecommitdiff
path: root/tests/requests
diff options
context:
space:
mode:
authorRaphael Merx <raphaelm@captricity.com>2015-10-30 15:05:11 -0700
committerTim Graham <timograham@gmail.com>2015-11-18 07:47:40 -0500
commit0a19f8d4fc864de481eac1b76c799ffd6ced4e91 (patch)
tree29a2fe6369a874560e9e51a897467d90826d18a8 /tests/requests
parent6258e163352690faf20bfc92c12468316d1a47ae (diff)
Fixed #25644 -- Fixed reset cookie expiry date bug.
Setting a cookie with the same name as a previously deleted cookie would set its expiry date to 'Thu, 01-Jan-1970 00:00:00 GMT'.
Diffstat (limited to 'tests/requests')
-rw-r--r--tests/requests/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/requests/tests.py b/tests/requests/tests.py
index 66fe8c92ec..180a5bca6b 100644
--- a/tests/requests/tests.py
+++ b/tests/requests/tests.py
@@ -208,6 +208,18 @@ class RequestsTests(SimpleTestCase):
datetime_cookie = response.cookies['datetime']
self.assertEqual(datetime_cookie['max-age'], 10)
+ def test_create_cookie_after_deleting_cookie(self):
+ """
+ Setting a cookie after deletion should clear the expiry date.
+ """
+ response = HttpResponse()
+ response.set_cookie('c', 'old-value')
+ self.assertEqual(response.cookies['c']['expires'], '')
+ response.delete_cookie('c')
+ self.assertEqual(response.cookies['c']['expires'], 'Thu, 01-Jan-1970 00:00:00 GMT')
+ response.set_cookie('c', 'new-value')
+ self.assertEqual(response.cookies['c']['expires'], '')
+
def test_far_expiration(self):
"Cookie will expire when an distant expiration time is provided"
response = HttpResponse()