summaryrefslogtreecommitdiff
path: root/service/test/unit/adapter/mailstore
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2015-09-02 18:07:51 -0300
committerDuda Dornelles <ddornell@thoughtworks.com>2015-09-02 18:09:33 -0300
commit19cda9ca7aa1aca18f61ebf659fc490f8ad4c15a (patch)
tree96095e86fe90c5505a27f689d515be45146685d7 /service/test/unit/adapter/mailstore
parentd01d60d4d7e9b8bdc7d8741e2567e30c8d476c0b (diff)
[feature] adding security_casing to LeapMail so we can show in the UI the signature and encryption status
Diffstat (limited to 'service/test/unit/adapter/mailstore')
-rw-r--r--service/test/unit/adapter/mailstore/test_leap_mail.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/service/test/unit/adapter/mailstore/test_leap_mail.py b/service/test/unit/adapter/mailstore/test_leap_mail.py
index 9b72d8c3..571e2f60 100644
--- a/service/test/unit/adapter/mailstore/test_leap_mail.py
+++ b/service/test/unit/adapter/mailstore/test_leap_mail.py
@@ -62,6 +62,10 @@ class TestLeapMail(TestCase):
'status': [],
'body': None,
'textPlainBody': None,
+ 'security_casing': {
+ 'imprints': [{'state': 'no_signature_information'}],
+ 'locks': []
+ },
'replying': {'all': {'cc-field': [],
'to-field': ['receiver@example.test',
'test@example.test',
@@ -125,3 +129,22 @@ class TestLeapMail(TestCase):
self.assertEquals([], mail.headers['To'])
self.assertEquals([], mail.headers['Cc'])
self.assertEquals([], mail.headers['Bcc'])
+
+ def test_security_casing(self):
+ # No Encryption, no Signature
+ mail = LeapMail('id', 'INBOX', {})
+ self.assertEqual({'locks': [], 'imprints': [{'state': 'no_signature_information'}]}, mail.security_casing)
+
+ # Encryption
+ mail = LeapMail('id', 'INBOX', {'X-Leap-Encryption': 'decrypted'})
+ self.assertEqual([{'state': 'valid'}], mail.security_casing['locks'])
+
+ mail = LeapMail('id', 'INBOX', {'X-Leap-Encryption': 'false'})
+ self.assertEqual([], mail.security_casing['locks'])
+
+ # Signature
+ mail = LeapMail('id', 'INBOX', {'X-Leap-Signature': 'valid'})
+ self.assertEqual([{'seal': {'validity': 'valid'}, 'state': 'valid'}], mail.security_casing['imprints'])
+
+ mail = LeapMail('id', 'INBOX', {'X-Leap-Signature': 'invalid'})
+ self.assertEqual([], mail.security_casing['imprints'])