def test_cc_without_recipients_2(self): from pyramid_mailer.message import Message msg = Message(subject="testing", sender="*****@*****.**", body="testing", cc=["*****@*****.**"]) response = msg.get_response() self.assertTrue("Cc: [email protected]" in str(response))
def test_bcc(self): from pyramid_mailer.message import Message msg = Message( subject="testing", recipients=["*****@*****.**"], body="testing", bcc=["*****@*****.**"] ) response = msg.get_response() self.assert_("Bcc: [email protected]" in str(response))
def test_bcc(self): from pyramid_mailer.message import Message msg = Message(subject="testing", recipients=["*****@*****.**"], body="testing", bcc=["*****@*****.**"]) response = msg.get_response() self.assert_("Bcc: [email protected]" in str(response))
def test_bcc_without_recipients(self): from pyramid_mailer.message import Message from pyramid_mailer.mailer import Mailer msg = Message(subject="testing", sender="*****@*****.**", body="testing", bcc=["*****@*****.**"]) mailer = Mailer() msgid = mailer.send(msg) response = msg.get_response() self.assertFalse("Bcc: [email protected]" in str(response)) self.assertTrue(msgid)
def test_attach(self): from pyramid_mailer.message import Message from pyramid_mailer.message import Attachment msg = Message(subject="testing", recipients=["*****@*****.**"], body="testing") msg.attach(Attachment(data="this is a test", content_type="text/plain")) a = msg.attachments[0] self.assertTrue(a.filename is None) self.assertEqual(a.disposition, "attachment") self.assertEqual(a.content_type, "text/plain") self.assertEqual(a.data, "this is a test") response = msg.get_response() self.assertEqual(len(response.attachments), 1)
def test_attach(self): from pyramid_mailer.message import Message from pyramid_mailer.message import Attachment msg = Message(subject="testing", recipients=["*****@*****.**"], body="testing") msg.attach(Attachment(data="this is a test", content_type="text/plain")) a = msg.attachments[0] self.assert_(a.filename is None) self.assert_(a.disposition == 'attachment') self.assert_(a.content_type == "text/plain") self.assert_(a.data == "this is a test") response = msg.get_response() self.assert_(len(response.attachments) == 1)