Unverified Commit 6a7d9d6d authored by Isis Lovecruft's avatar Isis Lovecruft
Browse files

Add unittest for SMTPAutoresponder.runChecks() with blacklisted email.

parent 387115d8
...@@ -38,7 +38,7 @@ EMAIL_DOMAIN_RULES = { ...@@ -38,7 +38,7 @@ EMAIL_DOMAIN_RULES = {
} }
EMAIL_DOMAINS = ["gmail.com", "example.com", "localhost"] EMAIL_DOMAINS = ["gmail.com", "example.com", "localhost"]
EMAIL_WHITELIST = {'white@list.ed': 'ABCD1234ABCD1234ABCD1234ABCD1234ABCD1234'} EMAIL_WHITELIST = {'white@list.ed': 'ABCD1234ABCD1234ABCD1234ABCD1234ABCD1234'}
EMAIL_BLACKLIST = ['feidanchaoren'] EMAIL_BLACKLIST = ['feidanchaoren0001@gmail.com']
EMAIL_FUZZY_MATCH = 4 EMAIL_FUZZY_MATCH = 4
EMAIL_USERNAME = "bridges" EMAIL_USERNAME = "bridges"
EMAIL_SMTP_HOST = "127.0.0.1" EMAIL_SMTP_HOST = "127.0.0.1"
......
...@@ -562,3 +562,10 @@ class SMTPAutoresponderTests(unittest.TestCase): ...@@ -562,3 +562,10 @@ class SMTPAutoresponderTests(unittest.TestCase):
self.message.lines.insert(3, header) self.message.lines.insert(3, header)
self._setUpResponder() self._setUpResponder()
self.assertFalse(self.responder.runChecks(emailFrom)) self.assertFalse(self.responder.runChecks(emailFrom))
def test_SMTPAutoresponder_runChecks_blacklisted(self):
"""runChecks() on an blacklisted email address should return False."""
emailFrom = Address('feidanchaoren0043@gmail.com')
self._getIncomingLines(str(emailFrom))
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