test_python_cryptography.py 931 B

12345678910111213141516171819202122232425262728293031323334
  1. from tests.package.test_python import TestPythonBase
  2. class TestPythonCryptography(TestPythonBase):
  3. def fernet_test(self, timeout=-1):
  4. cmd = self.interpreter + " -c 'from cryptography.fernet import Fernet;"
  5. cmd += "key = Fernet.generate_key();"
  6. cmd += "f = Fernet(key)'"
  7. _, exit_code = self.emulator.run(cmd, timeout)
  8. self.assertEqual(exit_code, 0)
  9. class TestPythonPy2Cryptography(TestPythonCryptography):
  10. config = TestPythonBase.config + \
  11. """
  12. BR2_PACKAGE_PYTHON=y
  13. BR2_PACKAGE_PYTHON_CRYPTOGRAPHY=y
  14. """
  15. def test_run(self):
  16. self.login()
  17. self.fernet_test(40)
  18. class TestPythonPy3Cryptography(TestPythonCryptography):
  19. config = TestPythonBase.config + \
  20. """
  21. BR2_PACKAGE_PYTHON3=y
  22. BR2_PACKAGE_PYTHON_CRYPTOGRAPHY=y
  23. """
  24. def test_run(self):
  25. self.login()
  26. self.fernet_test(40)