cubicweb/test/unittest_crypto.py
author Laurent Peuch <cortex@worlddomination.be>
Wed, 22 May 2019 01:16:55 +0200
changeset 12730 6c48a49cd3c2
parent 12682 da36da3f89f1
permissions -rw-r--r--
[pyramid/ctl] pyramid command will always run in foreground from now on Daemonization used to make sens in the past, but today "pyramid" command is only used for dev and should never be used for deployement (you should use a wsgi server for that instead) so daemonization doesn't fit any use case anymore. Closes #17232923

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