cubicweb/test/unittest_crypto.py
author Laurent Peuch <cortex@worlddomination.be>
Tue, 10 Dec 2019 23:34:46 +0100
changeset 12801 1156108afab9
parent 12682 da36da3f89f1
permissions -rw-r--r--
[doc/building/fix] encoding issue was crashing sphinx in python3

from unittest import TestCase

from cubicweb import crypto


class CryptoTC(TestCase):

    def test_encrypt_decrypt_roundtrip(self):
        data = {'a': u'ah', 'b': [1, 2]}
        seed = 's' * 16
        crypted = crypto.encrypt(data, seed)
        decrypted = crypto.decrypt(crypted, seed)
        self.assertEqual(decrypted, data)


if __name__ == '__main__':
    import unittest
    unittest.main()