def test_encryption_decryption_symmetry(): """Tests whether encryption and decryption is symmetrical.""" for input in testinputs: try: assert decrypt(encrypt(input)) == input except Exception as e: print(e) assert False
def test_convert_encrypted_to_securestring(): """Tests whether the output of encrypt() is compatible with PowerShell's SecureStrings by feeding its output to ConvertTo-SecureString.""" for input in testinputs: try: enc = encrypt(input) psres = runpscommand("\"%s\" | ConvertTo-SecureString" % enc) assert decode(psres, "utf-8") == "System.Security.SecureString" except Exception as e: print(e) assert False