def test_trash(self, _document): _document.return_value = Document() message = 123 document, original, signature = peal(message) self.assertEqual(document, _document.return_value) self.assertEqual(original, message) self.assertEqual(signature, None)
def test_unsigned(self): message = '{"A":1}' document, original, signature = peal(message) self.assertEqual(document['A'], 1) self.assertEqual(original, message) self.assertEqual(signature, None)
def test_signed(self): message = '{"message": "{\\"A\\":1}", "signature": "test-signature"}' document, original, signature = peal(message) self.assertEqual(document['A'], 1) self.assertEqual(original, '{"A":1}') self.assertEqual(signature, 'test-signature')
def test_unsigned(self): message = '{"A":1}' document, original, signature = peal(message) self.assertEqual(document['A'], 1) self.assertEqual(original, '{"A":1}') self.assertEqual(signature, None)