sign/unsign should be reversible
(self)
| 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") |