MCPcopy
hub / github.com/django/django / test_detects_tampering

Method test_detects_tampering

tests/signed_cookies_tests/tests.py:30–36  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

28 request.get_signed_cookie("a", salt="two")
29
30 def test_detects_tampering(self):
31 response = HttpResponse()
32 response.set_signed_cookie("c", "hello")
33 request = HttpRequest()
34 request.COOKIES["c"] = response.cookies["c"].value[:-2] + "$$"
35 with self.assertRaises(signing.BadSignature):
36 request.get_signed_cookie("c")
37
38 def test_default_argument_suppresses_exceptions(self):
39 response = HttpResponse()

Callers

nothing calls this directly

Calls 4

get_signed_cookieMethod · 0.95
HttpResponseClass · 0.90
HttpRequestClass · 0.90
set_signed_cookieMethod · 0.80

Tested by

no test coverage detected