mirror of
https://github.com/django/django.git
synced 2025-11-25 21:22:14 +00:00
Fixed #33562 -- Made HttpResponse.set_cookie() support timedelta for the max_age argument.
This commit is contained in:
parent
1882f6567d
commit
ae2da5ba65
5 changed files with 29 additions and 4 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue