summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/signing/tests.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/signing/tests.py b/tests/signing/tests.py
index 835ca4d6b2..50b2b0d9bb 100644
--- a/tests/signing/tests.py
+++ b/tests/signing/tests.py
@@ -122,6 +122,22 @@ class TestSigner(SimpleTestCase):
with self.assertRaises(signing.BadSignature):
signer.unsign(transform(signed_value))
+ def test_sign_unsign_object(self):
+ signer = signing.Signer('predictable-secret')
+ tests = [
+ ['a', 'list'],
+ 'a string \u2019',
+ {'a': 'dictionary'},
+ ]
+ for obj in tests:
+ with self.subTest(obj=obj):
+ signed_obj = signer.sign_object(obj)
+ self.assertNotEqual(obj, signed_obj)
+ self.assertEqual(obj, signer.unsign_object(signed_obj))
+ signed_obj = signer.sign_object(obj, compress=True)
+ self.assertNotEqual(obj, signed_obj)
+ self.assertEqual(obj, signer.unsign_object(signed_obj))
+
def test_dumps_loads(self):
"dumps and loads be reversible for any JSON serializable object"
objects = [