__init__.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # SelfTest/Protocol/__init__.py: Self-tests for Crypto.Protocol
  2. #
  3. # Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net>
  4. #
  5. # ===================================================================
  6. # The contents of this file are dedicated to the public domain. To
  7. # the extent that dedication to the public domain is not available,
  8. # everyone is granted a worldwide, perpetual, royalty-free,
  9. # non-exclusive license to exercise all rights associated with the
  10. # contents of this file for any purpose whatsoever.
  11. # No rights are reserved.
  12. #
  13. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  14. # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  15. # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  16. # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  17. # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  18. # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  19. # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. # SOFTWARE.
  21. # ===================================================================
  22. import sys
  23. """Self-test for Crypto.Protocol"""
  24. def get_tests(config={}):
  25. tests = []
  26. from Crypto.SelfTest.Protocol import test_rfc1751; tests += test_rfc1751.get_tests(config=config)
  27. from Crypto.SelfTest.Protocol import test_KDF; tests += test_KDF.get_tests(config=config)
  28. from Crypto.SelfTest.Protocol import test_ecdh; tests += test_ecdh.get_tests(config=config)
  29. from Crypto.SelfTest.Protocol import test_SecretSharing
  30. tests += test_SecretSharing.get_tests(config=config)
  31. if sys.version_info >= (3, 9):
  32. from Crypto.SelfTest.Protocol import test_HPKE
  33. tests += test_HPKE.get_tests(config=config)
  34. return tests
  35. if __name__ == '__main__':
  36. import unittest
  37. suite = lambda: unittest.TestSuite(get_tests())
  38. unittest.main(defaultTest='suite')