summaryrefslogtreecommitdiff
path: root/tests/integration/mail
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2017-10-24 12:46:48 +0200
committerRuben Pollan <meskio@sindominio.net>2017-10-26 18:37:05 +0200
commitec01098129d885911715260f5bffb701fa65028c (patch)
treee4186907e727f53fcd6caea63e1ac447e7770cdf /tests/integration/mail
parent5243c7eb4c58a4419da2103af8c1e4004f01053b (diff)
[bug] strip leap headers before processing the icnomming mails
- Resolves: #9030
Diffstat (limited to 'tests/integration/mail')
-rw-r--r--tests/integration/mail/incoming/test_incoming_mail.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/integration/mail/incoming/test_incoming_mail.py b/tests/integration/mail/incoming/test_incoming_mail.py
index 3dc7ca71..0deee65d 100644
--- a/tests/integration/mail/incoming/test_incoming_mail.py
+++ b/tests/integration/mail/incoming/test_incoming_mail.py
@@ -287,6 +287,27 @@ subject: independence of cyberspace
self.assertEquals(msg.headers['X-Leap-Encryption'], 'decrypted')
+ def testStripLeapHeaders(self):
+ ENC_HEADER = "fake encryption header"
+ SIG_HEADER = "fake signature header"
+
+ message = Parser().parsestr(self.EMAIL)
+ message.add_header("X-Leap-Encryption", ENC_HEADER)
+ message.add_header("X-Leap-Signature", SIG_HEADER)
+ self.fetcher._add_message_locally = Mock()
+
+ def check_headers(_):
+ self.assertTrue(self.fetcher._add_message_locally.called,
+ "The message was not added to soledad")
+ _, data = self.fetcher._add_message_locally.call_args[0][0]
+ msg = Parser().parsestr(data)
+ self.assertNotEqual(msg.get('X-Leap-Encryption', ''), ENC_HEADER)
+ self.assertNotEqual(msg.get('X-Leap-Signature', ''), SIG_HEADER)
+
+ d = self._do_fetch(message.as_string())
+ d.addCallback(check_headers)
+ return d
+
def testDecryptEmail(self):
self.fetcher._decryption_error = Mock()