cubicweb/test/unittest_crypto.py
author Simon Chabot <simon.chabot@logilab.fr>
Wed, 12 Feb 2020 13:58:17 +0100
changeset 12890 0cd5b9057202
parent 12682 da36da3f89f1
permissions -rw-r--r--
[pyramid, predicate] Add a predicate that matches if the pattern is an eid in the DB

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()