01-secret-generator.py 782 B

123456789101112131415161718192021222324252627
  1. import sys
  2. import pathlib
  3. file = pathlib.Path(__file__)
  4. directory = file.parent
  5. import_root = directory.parent
  6. sys.path.append(str(import_root))
  7. from assets import secret_generator
  8. password_a = secret_generator("Password_a")
  9. password_b = secret_generator("Password_b")
  10. verify_password_a = secret_generator("Password_a")
  11. print("Check secret generation: ")
  12. print("Secret for 'Password_a': " + password_a.secret)
  13. print("Check that secret is generated once in the single instance: ")
  14. print("Secret for 'Password_a': " + password_a.secret)
  15. print("Secret for 'Password_b': " + password_b.secret)
  16. validation_result = "False"
  17. if verify_password_a.validate(password_a.secret):
  18. validation_result = "True"
  19. print("Check validation for 'Password_a' by secret: " + validation_result)