diff options
Diffstat (limited to 'src/mailman_pgp/pgp/tests/test_inline.py')
| -rw-r--r-- | src/mailman_pgp/pgp/tests/test_inline.py | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/src/mailman_pgp/pgp/tests/test_inline.py b/src/mailman_pgp/pgp/tests/test_inline.py index c6d1d89..1c51fce 100644 --- a/src/mailman_pgp/pgp/tests/test_inline.py +++ b/src/mailman_pgp/pgp/tests/test_inline.py @@ -32,7 +32,11 @@ class TestSigning(PGPTestCase, unittest.TestCase): (load_message('data/inline_signed.eml'), True), (load_message('data/inline_signed_invalid.eml'), - True) + True), + (load_message('data/clear.eml'), + False), + (load_message('data/inline_encrypted.eml'), + False) ]) def test_is_signed(self, message, signed): wrapped = self.wrapper(message) @@ -55,11 +59,32 @@ class TestSigning(PGPTestCase, unittest.TestCase): class TestEncryption(PGPTestCase, unittest.TestCase): - def test_is_encrypted(self): - pass + def setUp(self): + self.wrapper = InlineWrapper + + @parameterized.expand([ + (load_message('data/inline_encrypted.eml'), + True), + (load_message('data/inline_signed.eml'), + False), + (load_message('data/inline_signed_invalid.eml'), + False), + (load_message('data/clear.eml'), + False) + ]) + def test_is_encrypted(self, message, encrypted): + wrapped = self.wrapper(message) + self.assertEqual(wrapped.is_encrypted(), encrypted) def test_encrypt(self): pass - def test_decrypt(self): - pass + @parameterized.expand([ + (load_message('data/inline_encrypted.eml'), + load_key('data/rsa_1024.priv.asc'), + 'Some encrypted text.\n\n') + ]) + def test_decrypt(self, message, key, clear): + wrapped = self.wrapper(message) + self.assertEqual(wrapped.decrypt(key).message, + bytearray(clear, 'latin-1')) |
