diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-07-26 19:54:21 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2017-08-17 10:59:49 -0700 |
commit | 26511b7a21acab317aab0832dcb7fd455ab1b496 (patch) | |
tree | 00cb14c6ecb9e3c4a5470ed66876e871996cbaf1 /tests/db | |
parent | 72f38d180ebba19b5479ded08f6df0acd7acd7d2 (diff) |
tests/db/utils: Add tests for encapsulating gpg messages
It is valid to encapsulate the multipart/signed and multipart/encrypted
payloads in a multipart/mixed payload.
All of these tests currently fail.
Diffstat (limited to 'tests/db')
-rw-r--r-- | tests/db/utils_test.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/db/utils_test.py b/tests/db/utils_test.py index b18bbd82..ea0b6f20 100644 --- a/tests/db/utils_test.py +++ b/tests/db/utils_test.py @@ -592,3 +592,39 @@ class TestMessageFromFile(TestCaseClassCleanup): m = utils.message_from_file(io.BytesIO(m.as_string())) self.assertIn('Malformed OpenPGP message:', m.get_payload(2).get_payload()) + + @unittest.expectedFailure + def test_signed_in_multipart_mixed(self): + """It is valid to encapsulate a multipart/signed payload inside a + multipart/mixed payload, verify that works. + """ + s = self._make_signed() + m = email.mime.multipart.MIMEMultipart('mixed', None, [s]) + m = utils.message_from_file(io.BytesIO(m.as_string())) + self.assertIn(utils.X_SIGNATURE_VALID_HEADER, m) + self.assertIn(utils.X_SIGNATURE_MESSAGE_HEADER, m) + + @unittest.expectedFailure + def test_encrypted_unsigned_in_multipart_mixed(self): + """It is valid to encapsulate a multipart/encrypted payload inside a + multipart/mixed payload, verify that works. + """ + s = self._make_encrypted() + m = email.mime.multipart.MIMEMultipart('mixed', None, [s]) + m = utils.message_from_file(io.BytesIO(m.as_string())) + self.assertIn('This is some text', [n.get_payload() for n in m.walk()]) + self.assertNotIn(utils.X_SIGNATURE_VALID_HEADER, m) + self.assertNotIn(utils.X_SIGNATURE_MESSAGE_HEADER, m) + + @unittest.expectedFailure + def test_encrypted_signed_in_multipart_mixed(self): + """It is valid to encapsulate a multipart/encrypted payload inside a + multipart/mixed payload, verify that works when the multipart/encrypted + contains a multipart/signed. + """ + s = self._make_encrypted(True) + m = email.mime.multipart.MIMEMultipart('mixed', None, [s]) + m = utils.message_from_file(io.BytesIO(m.as_string())) + self.assertIn('This is some text', [n.get_payload() for n in m.walk()]) + self.assertIn(utils.X_SIGNATURE_VALID_HEADER, m) + self.assertIn(utils.X_SIGNATURE_MESSAGE_HEADER, m) |