[tor-commits] [bridgedb/develop] Add unittest for MailMessage.getRecipient() w/ email address that isn't ours.

isis at torproject.org isis at torproject.org
Fri Jun 6 20:40:38 UTC 2014


commit 27107de9b94072bed64ceb29160a783a1624360e
Author: Isis Lovecruft <isis at torproject.org>
Date:   Wed May 21 14:58:32 2014 +0000

    Add unittest for MailMessage.getRecipient() w/ email address that isn't ours.
    
    An email sent to 'notbridgedb at yikezors.net' that somehow ends up in our
    queue should return the EMAIL_SMTP_FROM_ADDRESS that we're configured to
    use.
---
 lib/bridgedb/test/test_email_server.py |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/bridgedb/test/test_email_server.py b/lib/bridgedb/test/test_email_server.py
index 7805458..f58b36f 100644
--- a/lib/bridgedb/test/test_email_server.py
+++ b/lib/bridgedb/test/test_email_server.py
@@ -312,6 +312,17 @@ class MailMessageTests(unittest.TestCase):
         ]
         self.message.lines = lines
 
+    def test_MailMessage_getRecipient_notbridgedb_at_yikezors_dot_net(self):
+        """MailMessage.getRecipient() for an incoming email sent to any email
+        address other than the one we're listening for should return our
+        configured address, not the one in the incoming email.
+        """
+        self._getIncomingLines()
+        self.message.lines[1] = 'To: notbridgedb at yikezors.net'
+        incoming = self.message.getIncomingMessage()
+        recipient = self.message.getRecipient(incoming)
+        self.assertEqual(recipient, self.context.fromAddr)
+
     def test_MailMessage_reply_noFrom(self):
         """A received email without a "From:" or "Sender:" header shouldn't
         receive a response.





More information about the tor-commits mailing list