summaryrefslogtreecommitdiff
path: root/tests/responses
diff options
context:
space:
mode:
authorLuke Plant <L.Plant.98@cantab.net>2022-03-04 12:57:10 +0000
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-03-07 07:57:14 +0100
commitae2da5ba652c1a11cd88dcb119744dcecaeb03ee (patch)
tree5f79e182a07457487abe2f0108a2f1f65ad8a72d /tests/responses
parent1882f6567df361f52e53b555b2faa677361e128a (diff)
downloaddjango-ae2da5ba652c1a11cd88dcb119744dcecaeb03ee.tar.gz
Fixed #33562 -- Made HttpResponse.set_cookie() support timedelta for the max_age argument.
Diffstat (limited to 'tests/responses')
-rw-r--r--tests/responses/test_cookie.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/responses/test_cookie.py b/tests/responses/test_cookie.py
index b37c6fb7b6..3a57dcfe45 100644
--- a/tests/responses/test_cookie.py
+++ b/tests/responses/test_cookie.py
@@ -71,6 +71,11 @@ class SetCookieTests(SimpleTestCase):
response.set_cookie("max_age", max_age=10.6)
self.assertEqual(response.cookies["max_age"]["max-age"], 10)
+ def test_max_age_timedelta(self):
+ response = HttpResponse()
+ response.set_cookie("max_age", max_age=timedelta(hours=1))
+ self.assertEqual(response.cookies["max_age"]["max-age"], 3600)
+
def test_httponly_cookie(self):
response = HttpResponse()
response.set_cookie("example", httponly=True)