MCPcopy
hub / github.com/django/django / test_sign_unsign

Method test_sign_unsign

tests/signing/tests.py:70–84  ·  view source on GitHub ↗

sign/unsign should be reversible

(self)

Source from the content-addressed store, hash-verified

68 signer.sign("hello")
69
70 def test_sign_unsign(self):
71 "sign/unsign should be reversible"
72 signer = signing.Signer(key="predictable-secret")
73 examples = [
74 "q;wjmbk;wkmb",
75 "3098247529087",
76 "3098247:529:087:",
77 "jkw osanteuh ,rcuh nthu aou oauh ,ud du",
78 "\u2019",
79 ]
80 for example in examples:
81 signed = signer.sign(example)
82 self.assertIsInstance(signed, str)
83 self.assertNotEqual(example, signed)
84 self.assertEqual(example, signer.unsign(signed))
85
86 def test_sign_unsign_non_string(self):
87 signer = signing.Signer(key="predictable-secret")

Callers

nothing calls this directly

Calls 2

signMethod · 0.95
unsignMethod · 0.95

Tested by

no test coverage detected