Fix assertions and add extra assertions to multi-recipient encryption test.
parent
1cfd8b636d
commit
e9498e91a9
|
@ -877,21 +877,31 @@ authentication."""
|
||||||
log.debug("encryption_decryption_multi_recipient() Ciphertext = %s"
|
log.debug("encryption_decryption_multi_recipient() Ciphertext = %s"
|
||||||
% encrypted)
|
% encrypted)
|
||||||
|
|
||||||
self.assertNotEqual(message, encrypted)
|
self.assertNotEquals(message, encrypted)
|
||||||
dec_alice = self.gpg.decrypt(encrypted, passphrase="test")
|
dec_alice = self.gpg.decrypt(encrypted, passphrase="test")
|
||||||
self.assertEqual(message, str(dec_alice.data))
|
self.assertEquals(message, str(dec_alice.data))
|
||||||
dec_bob = self.gpg.decrypt(encrypted, passphrase="test")
|
dec_bob = self.gpg.decrypt(encrypted, passphrase="test")
|
||||||
self.assertEqual(message, str(dec_bob.data))
|
self.assertEquals(message, str(dec_bob.data))
|
||||||
|
|
||||||
def test_symmetric_encryption_and_decryption(self):
|
def test_symmetric_encryption_and_decryption(self):
|
||||||
"""Test symmetric encryption and decryption"""
|
"""Test symmetric encryption and decryption"""
|
||||||
msg = """If you have something that you don't want anyone to know,
|
msg = """If you have something that you don't want anyone to
|
||||||
maybe you shouldn't be doing it in the first place. - Eric Schmidt, CEO
|
know, maybe you shouldn't be doing it in the first place.
|
||||||
of Google"""
|
-- Eric Schmidt, CEO of Google"""
|
||||||
encrypted = str(self.gpg.encrypt(msg, passphrase='quiscustodiet',
|
encrypted = str(self.gpg.encrypt(msg, passphrase='quiscustodiet',
|
||||||
symmetric=True, encrypt=False))
|
symmetric=True, encrypt=False))
|
||||||
decrypted = self.gpg.decrypt(encrypted, passphrase='quiscustodiet')
|
decrypt = self.gpg.decrypt(encrypted, passphrase='quiscustodiet')
|
||||||
self.assertEqual(msg, str(decrypted.data))
|
decrypted = str(decrypt.data)
|
||||||
|
|
||||||
|
log.info("Symmetrically encrypted data:\n%s" % encrypted)
|
||||||
|
log.info("Symmetrically decrypted data:\n%s" % decrypted)
|
||||||
|
|
||||||
|
self.assertIsNotNone(encrypted)
|
||||||
|
self.assertNotEquals(encrypted, "")
|
||||||
|
self.assertNotEquals(encrypted, msg)
|
||||||
|
self.assertIsNotNone(decrypted)
|
||||||
|
self.assertNotEquals(decrypted, "")
|
||||||
|
self.assertEqual(decrypted, msg)
|
||||||
|
|
||||||
def test_file_encryption_and_decryption(self):
|
def test_file_encryption_and_decryption(self):
|
||||||
"""Test that encryption/decryption to/from file works."""
|
"""Test that encryption/decryption to/from file works."""
|
||||||
|
|
Loading…
Reference in New Issue