cubicweb/test/unittest_crypto.py
author Jérémy Bobbio <jeremy.bobbio@irq7.fr>
Wed, 19 Jun 2019 09:51:38 +0200
changeset 12663 853e73456d0f
parent 12615 7abe23cbfda1
child 12682 da36da3f89f1
permissions -rw-r--r--
[skeleton] Update Debian packaging template Here are multiple updates to the Debian packaging template provided when running `cubicweb-ctl newcube`: * Switch to source format 3.0 (quilt). * Switch to debhelper 9. * Switch to dh-python. * Switch to Python 3. * Name the binary package `python3-cubicweb-CUBENAME` instead of just `cubicweb-CUBENAME` (which is still the source package). * Populate Depends using dh_python3 support for Python requirements. * Run test suite at build time using pytest. * Add autopkgtest to run test suite against the installed package. * Bump Standards-Version to 4.3.0.

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 = 'ssss'
        crypted = crypto.encrypt(data, seed)
        decrypted = crypto.decrypt(crypted, seed)
        self.assertEqual(decrypted, data)


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