diff options
| author | J08nY | 2017-06-22 20:23:37 +0200 |
|---|---|---|
| committer | J08nY | 2017-06-22 20:23:37 +0200 |
| commit | 35f73955ab03c65936aad59511d92d87f645e3ea (patch) | |
| tree | 22fe38f1444750d9149bdf09057cde4d4534625a /src/mailman_pgp/pgp/tests/test_inline.py | |
| parent | 263577d4826630e6871b35c73fe3dd114ee70e22 (diff) | |
| download | mailman-pgp-35f73955ab03c65936aad59511d92d87f645e3ea.tar.gz mailman-pgp-35f73955ab03c65936aad59511d92d87f645e3ea.tar.zst mailman-pgp-35f73955ab03c65936aad59511d92d87f645e3ea.zip | |
Diffstat (limited to 'src/mailman_pgp/pgp/tests/test_inline.py')
| -rw-r--r-- | src/mailman_pgp/pgp/tests/test_inline.py | 47 |
1 files changed, 14 insertions, 33 deletions
diff --git a/src/mailman_pgp/pgp/tests/test_inline.py b/src/mailman_pgp/pgp/tests/test_inline.py index d144991..b6d84ec 100644 --- a/src/mailman_pgp/pgp/tests/test_inline.py +++ b/src/mailman_pgp/pgp/tests/test_inline.py @@ -15,19 +15,19 @@ # You should have received a copy of the GNU General Public License along with # this program. If not, see <http://www.gnu.org/licenses/>. -"""""" -import unittest +"""Tests for the inline wrapper.""" from parameterized import parameterized from mailman_pgp.pgp.inline import InlineWrapper -from mailman_pgp.pgp.tests.base import load_key, load_message, PGPTestCase +from mailman_pgp.pgp.tests.base import load_key, load_message, WrapperTestCase -class TestSigning(PGPTestCase, unittest.TestCase): - def setUp(self): - self.wrapper = InlineWrapper +class InlineWrapperTestCase(WrapperTestCase): + wrapper = InlineWrapper + +class TestSigning(InlineWrapperTestCase): @parameterized.expand([ (load_message('data/inline_signed.eml'), True), @@ -39,8 +39,7 @@ class TestSigning(PGPTestCase, unittest.TestCase): False) ]) def test_is_signed(self, message, signed): - wrapped = self.wrapper(message) - self.assertEqual(wrapped.is_signed(), signed) + super().is_signed(message, signed) def test_sign(self): pass @@ -54,14 +53,10 @@ class TestSigning(PGPTestCase, unittest.TestCase): False) ]) def test_verify(self, message, key, valid): - wrapped = self.wrapper(message) - self.assertEqual(bool(wrapped.verify(key)), valid) - + super().verify(message, key, valid) -class TestEncryption(PGPTestCase, unittest.TestCase): - def setUp(self): - self.wrapper = InlineWrapper +class TestEncryption(InlineWrapperTestCase): @parameterized.expand([ (load_message('data/inline_encrypted.eml'), True), @@ -73,8 +68,7 @@ class TestEncryption(PGPTestCase, unittest.TestCase): False) ]) def test_is_encrypted(self, message, encrypted): - wrapped = self.wrapper(message) - self.assertEqual(wrapped.is_encrypted(), encrypted) + super().is_encrypted(message, encrypted) def test_encrypt(self): pass @@ -85,15 +79,10 @@ class TestEncryption(PGPTestCase, unittest.TestCase): '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')) - + super().decrypt(message, key, clear) -class TestKeys(PGPTestCase, unittest.TestCase): - def setUp(self): - self.wrapper = InlineWrapper +class TestKeys(InlineWrapperTestCase): @parameterized.expand([ (load_message('data/inline_privkey.eml'), True), @@ -105,8 +94,7 @@ class TestKeys(PGPTestCase, unittest.TestCase): False) ]) def test_has_keys(self, message, has_keys): - wrapped = self.wrapper(message) - self.assertEqual(wrapped.has_keys(), has_keys) + super().has_keys(message, has_keys) @parameterized.expand([ (load_message('data/inline_privkey.eml'), @@ -115,11 +103,4 @@ class TestKeys(PGPTestCase, unittest.TestCase): [load_key('data/rsa_1024.pub.asc')]) ]) def test_keys(self, message, keys): - wrapped = self.wrapper(message) - loaded = list(wrapped.keys()) - loaded_fingerprints = list(map(lambda key: key.fingerprint, loaded)) - - self.assertEqual(len(loaded), len(keys)) - - fingerprints = list(map(lambda key: key.fingerprint, keys)) - self.assertListEqual(loaded_fingerprints, fingerprints) + super().keys(message, keys) |
