Unverified Commit e9aa7bba authored by Isis Lovecruft's avatar Isis Lovecruft
Browse files

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().
parent 6fbe6f03
......@@ -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))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment