[tor-commits] [bridgedb/develop] Add unittest for SMTPAutoresponder.runChecks() with blacklisted email.

isis at torproject.org isis at torproject.org
Thu Jul 24 04:37:11 UTC 2014


commit 6a7d9d6de0a0d4cbbdec87d7a13b14cdeae0b686
Author: Isis Lovecruft <isis at torproject.org>
Date:   Mon Jul 7 16:16:27 2014 +0000

    Add unittest for SMTPAutoresponder.runChecks() with blacklisted email.
---
 lib/bridgedb/test/email_helpers.py            |    2 +-
 lib/bridgedb/test/test_email_autoresponder.py |    7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/bridgedb/test/email_helpers.py b/lib/bridgedb/test/email_helpers.py
index db52561..867ff58 100644
--- a/lib/bridgedb/test/email_helpers.py
+++ b/lib/bridgedb/test/email_helpers.py
@@ -38,7 +38,7 @@ EMAIL_DOMAIN_RULES = {
 }
 EMAIL_DOMAINS = ["gmail.com", "example.com", "localhost"]
 EMAIL_WHITELIST = {'white at list.ed': 'ABCD1234ABCD1234ABCD1234ABCD1234ABCD1234'}
-EMAIL_BLACKLIST = ['feidanchaoren']
+EMAIL_BLACKLIST = ['feidanchaoren0001 at gmail.com']
 EMAIL_FUZZY_MATCH = 4
 EMAIL_USERNAME = "bridges"
 EMAIL_SMTP_HOST = "127.0.0.1"
diff --git a/lib/bridgedb/test/test_email_autoresponder.py b/lib/bridgedb/test/test_email_autoresponder.py
index 39cf1bd..c94c909 100644
--- a/lib/bridgedb/test/test_email_autoresponder.py
+++ b/lib/bridgedb/test/test_email_autoresponder.py
@@ -562,3 +562,10 @@ class SMTPAutoresponderTests(unittest.TestCase):
         self.message.lines.insert(3, header)
         self._setUpResponder()
         self.assertFalse(self.responder.runChecks(emailFrom))
+
+    def test_SMTPAutoresponder_runChecks_blacklisted(self):
+        """runChecks() on an blacklisted email address should return False."""
+        emailFrom = Address('feidanchaoren0043 at gmail.com')
+        self._getIncomingLines(str(emailFrom))
+        self._setUpResponder()
+        self.assertFalse(self.responder.runChecks(emailFrom))





More information about the tor-commits mailing list