MCPcopy
hub / github.com/django/django / test_can_use_salt

Method test_can_use_salt

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

Source from the content-addressed store, hash-verified

18 self.assertEqual(value, "hello")
19
20 def test_can_use_salt(self):
21 response = HttpResponse()
22 response.set_signed_cookie("a", "hello", salt="one")
23 request = HttpRequest()
24 request.COOKIES["a"] = response.cookies["a"].value
25 value = request.get_signed_cookie("a", salt="one")
26 self.assertEqual(value, "hello")
27 with self.assertRaises(signing.BadSignature):
28 request.get_signed_cookie("a", salt="two")
29
30 def test_detects_tampering(self):
31 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