[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit 27107de9b94072bed64ceb29160a783a1624360e
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
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@xxxxxxxxxxxx' 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@xxxxxxxxxxxx'
+        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.



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits