MCPcopy
hub / github.com/django/django / test_max_age_expiration

Method test_max_age_expiration

tests/responses/test_cookie.py:63–71  ·  view source on GitHub ↗

Cookie will expire if max_age is provided.

(self)

Source from the content-addressed store, hash-verified

61 )
62
63 def test_max_age_expiration(self):
64 """Cookie will expire if max_age is provided."""
65 response = HttpResponse()
66 set_cookie_time = time.time()
67 with freeze_time(set_cookie_time):
68 response.set_cookie("max_age", max_age=10)
69 max_age_cookie = response.cookies["max_age"]
70 self.assertEqual(max_age_cookie["max-age"], 10)
71 self.assertEqual(max_age_cookie["expires"], http_date(set_cookie_time + 10))
72
73 def test_max_age_int(self):
74 response = HttpResponse()

Callers

nothing calls this directly

Calls 5

HttpResponseClass · 0.90
freeze_timeFunction · 0.90
http_dateFunction · 0.90
timeMethod · 0.80
set_cookieMethod · 0.45

Tested by

no test coverage detected