diff options
author | Duda Dornelles <ddornell@thoughtworks.com> | 2015-09-02 16:14:56 -0300 |
---|---|---|
committer | Duda Dornelles <ddornell@thoughtworks.com> | 2015-09-02 16:14:56 -0300 |
commit | 1d70a21a4b6476fb69122c0629440815aa793099 (patch) | |
tree | 83e33dda995ec2cf68f2ba2b068319985d067b24 /src/leap/mail/incoming/tests | |
parent | 43c920f38d1c114e9044d2da15d4a05d5faab79d (diff) |
[feat] adding encryption header to msg before saving
This way we can tell if a message was originally encrypted, so that we
can show that information to the end user.
Diffstat (limited to 'src/leap/mail/incoming/tests')
-rw-r--r-- | src/leap/mail/incoming/tests/test_incoming_mail.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/leap/mail/incoming/tests/test_incoming_mail.py b/src/leap/mail/incoming/tests/test_incoming_mail.py index f43f746..798824a 100644 --- a/src/leap/mail/incoming/tests/test_incoming_mail.py +++ b/src/leap/mail/incoming/tests/test_incoming_mail.py @@ -176,8 +176,22 @@ subject: independence of cyberspace d.addCallback(put_raw_key_called) return d + def testAddDecryptedHeader(self): + class DummyMsg(): + def __init__(self): + self.headers = {} + + def add_header(self, k, v): + self.headers[k]=v + + msg = DummyMsg() + self.fetcher._add_decrypted_header(msg) + + self.assertEquals(msg.headers['X-Leap-Encryption'], 'decrypted') + def testDecryptEmail(self): self.fetcher._decryption_error = Mock() + self.fetcher._add_decrypted_header = Mock() def create_encrypted_message(encstr): message = Parser().parsestr(self.EMAIL) @@ -198,9 +212,16 @@ subject: independence of cyberspace return newmsg def decryption_error_not_called(_): - self.assertFalse(self.fetcher._decyption_error.called, + self.assertFalse(self.fetcher._decryption_error.called, "There was some errors with decryption") + def add_decrypted_header_called(_): + self.assertTrue(self.fetcher._add_decrypted_header.called, + "There was some errors with decryption") + + + + d = self._km.encrypt( self.EMAIL, ADDRESS, OpenPGPKey, sign=ADDRESS_2) |