diff options
| author | J08nY | 2017-06-21 18:40:47 +0200 |
|---|---|---|
| committer | J08nY | 2017-06-21 18:40:47 +0200 |
| commit | 735695ca7d8cca1e687e209b359064350087f1a7 (patch) | |
| tree | 756c4a4ad53e50f34705c1bd940e542948dca319 /src/mailman_pgp/pgp/tests/test_inline.py | |
| parent | 16ef2af65c160872d7cc1243199ed2dc4646ccba (diff) | |
| download | mailman-pgp-735695ca7d8cca1e687e209b359064350087f1a7.tar.gz mailman-pgp-735695ca7d8cca1e687e209b359064350087f1a7.tar.zst mailman-pgp-735695ca7d8cca1e687e209b359064350087f1a7.zip | |
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')) |
