From d2d08c8cf6ed601d52e25cb8fc7944d39b5ed56e Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Fri, 4 Sep 2020 14:04:21 +0200 Subject: Fixed #31982 -- Made HttpResponse.set_cookie() cast max_age argument to an integer. --- tests/responses/test_cookie.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests') diff --git a/tests/responses/test_cookie.py b/tests/responses/test_cookie.py index c7c35219b2..fd3a55442c 100644 --- a/tests/responses/test_cookie.py +++ b/tests/responses/test_cookie.py @@ -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) -- cgit v1.3