commit e9aa7bbacfadc700b5fb88548009d669c60c33aa Author: Isis Lovecruft isis@torproject.org Date: Thu Jun 5 02:55:38 2014 +0000
Split unittest for SMTPAutoresponder DKIM runChecks().
We should specifically check that a received email containing a
X-DKIM-Authentication-Results: dunno
header doesn't successfully pass the domain checks called in SMTPAutoresponder.runChecks().
* CHANGE test_SMTPAutoresponder_runChecks_badDKIM() into test_SMTPAutoresponder_runChecks_DKIM_dunno() and test_SMTPAutoresponder_runChecks_DKIM_bad(). --- lib/bridgedb/test/test_email_autoresponder.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/lib/bridgedb/test/test_email_autoresponder.py b/lib/bridgedb/test/test_email_autoresponder.py index ed22a72..880afa6 100644 --- a/lib/bridgedb/test/test_email_autoresponder.py +++ b/lib/bridgedb/test/test_email_autoresponder.py @@ -535,13 +535,26 @@ class SMTPAutoresponderTests(unittest.TestCase): self.responder.incoming.canonicalFromSMTP = smtpFrom self.assertFalse(self.responder.runChecks(emailFrom))
- def test_SMTPAutoresponder_runChecks_badDKIM(self): - """runChecks() should catch emails with bad DKIM headers for canonical - domains which we've configured to check DKIM verification results for. + def test_SMTPAutoresponder_runChecks_DKIM_dunno(self): + """runChecks() should catch emails with bad DKIM headers + (``"X-DKIM-Authentication-Results: dunno"``) for canonical domains + which we're configured to check DKIM verification results for. """ - emailFrom = Address('dkimlikewat@gmail.com') + emailFrom = Address('dkimlikedunno@gmail.com') header = "X-DKIM-Authentication-Results: dunno" self._getIncomingLines(str(emailFrom)) self.message.lines.insert(3, header) self._setUpResponder() self.assertFalse(self.responder.runChecks(emailFrom)) + + def test_SMTPAutoresponder_runChecks_DKIM_bad(self): + """runChecks() should catch emails with bad DKIM headers + (``"X-DKIM-Authentication-Results: dunno"``) for canonical domains + which we're configured to check DKIM verification results for. + """ + emailFrom = Address('dkimlikewat@gmail.com') + header = "X-DKIM-Authentication-Results: wowie zowie there's a sig here" + self._getIncomingLines(str(emailFrom)) + self.message.lines.insert(3, header) + self._setUpResponder() + self.assertFalse(self.responder.runChecks(emailFrom))
tor-commits@lists.torproject.org