def testEncrypt(self): mgr = YokadiCryptoManager() mgr.force_decrypt = True # Simulate user ask for decryption tui.addInputAnswers("mySecretPassphrase") important_sentence = "Don't tell anyone" encrypted_sentence = mgr.encrypt(important_sentence) decrypted_sentence = mgr.decrypt(encrypted_sentence) self.assertEqual(important_sentence, decrypted_sentence) # Enter again same passphrase and check it is ok mgr = YokadiCryptoManager() tui.addInputAnswers("mySecretPassphrase")
def testEncryptLongSentence(self): mgr = YokadiCryptoManager() mgr.force_decrypt = True # Simulate user ask for decryption tui.addInputAnswers("mySecretPassphrase") important_sentence = '''This sentence is long long long long This sentence is long This sentence is long This sentence is long This sentence is long long long''' encrypted_sentence = mgr.encrypt(important_sentence) decrypted_sentence = mgr.decrypt(encrypted_sentence) self.assertEqual(important_sentence, decrypted_sentence)