Ejemplo n.º 1
0
    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))
Ejemplo n.º 2
0
    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))
Ejemplo n.º 3
0
    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))
Ejemplo n.º 4
0
    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)
Ejemplo n.º 5
0
    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)
Ejemplo n.º 6
0
    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)