1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #31982 -- Made HttpResponse.set_cookie() cast max_age argument to an integer.

This commit is contained in:
Hasan Ramezani
2020-09-04 14:04:21 +02:00
committed by Mariusz Felisiak
parent e6b5108acc
commit d2d08c8cf6
3 changed files with 8 additions and 3 deletions

View File

@@ -65,6 +65,11 @@ class SetCookieTests(SimpleTestCase):
self.assertEqual(max_age_cookie['max-age'], 10)
self.assertEqual(max_age_cookie['expires'], http_date(set_cookie_time + 10))
def test_max_age_int(self):
response = HttpResponse()
response.set_cookie('max_age', max_age=10.6)
self.assertEqual(response.cookies['max_age']['max-age'], 10)
def test_httponly_cookie(self):
response = HttpResponse()
response.set_cookie('example', httponly=True)