Beispiel #1
0
    def test_multiple_to(self):
        # Construct a message with the FROM and another email are in TO
        frm = "*****@*****.**"
        to = "*****@*****.**"
        to2 = "*****@*****.**"
        cc = "*****@*****.**"
        bcc = "*****@*****.**"
        message = MailgunMessage(frm,
                                 to,
                                 "Test Subject",
                                 body_text="this is a test")
        message.add_to(frm)
        message.add_to(to2)
        message.add_cc(cc)
        message.add_bcc(bcc)

        # Make sure CC and BCC didn't get removed
        mailgun_data = message.get_mailgun_data()
        self.assertEqual(1, len(mailgun_data["cc"]))
        self.assertTrue(cc in mailgun_data["cc"])
        self.assertEqual(1, len(mailgun_data["bcc"]))
        self.assertTrue(bcc in mailgun_data["bcc"])

        # Make sure TO, TO2 is in TO and FROM is not
        self.assertEqual(2, len(mailgun_data["to"]))
        self.assertTrue(to in mailgun_data["to"])
        self.assertTrue(to2 in mailgun_data["to"])
        self.assertFalse(frm in mailgun_data["to"])
Beispiel #2
0
 def get_sample_message(self):
     """Return a message with everyone in the TO, CC, and BCC."""
     message = MailgunMessage(self.bob,
                              self.alice,
                              "Test Subject",
                              body_text="this is a test")
     message.add_to(self.frank)
     message.add_to(self.bob)
     message.add_cc(self.frank)
     message.add_cc(self.alice)
     message.add_cc(self.bob)
     message.add_bcc(self.bob)
     message.add_bcc(self.alice)
     message.add_bcc(self.frank)
     return message