예제 #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.to_message()
        self.assertTrue("Cc: [email protected]" in text_type(response))
예제 #2
0
    def test_cc_without_recipients_2(self):

        from pyramid_mailer.message import Message

        msg = Message(subject="testing",
                      sender="*****@*****.**",
                      body="testing",
                      cc=["*****@*****.**"])
        response = msg.to_message()
        self.assertTrue("Cc: [email protected]" in text_type(response))
예제 #3
0
    def test_message_is_quoted_printable_with_text_body(self):
        from pyramid_mailer.message import Message

        msg = Message(
            recipients=['*****@*****.**'],
            subject="testing",
            sender="*****@*****.**",
            body="THISSHOULDBEINMESSAGEBODY",
        )

        response = msg.to_message()
        self.assertTrue("THISSHOULDBEINMESSAGEBODY" in text_type(response))
예제 #4
0
 def test_to_message_multiple_to_recipients(self):
     from pyramid_mailer.message import Message
     response = Message(
         subject="Subject",
         sender="From",
         recipients=["*****@*****.**", "*****@*****.**"],
         body="Body",
         html="Html",
     )
     message = response.to_message()
     self.assertEqual(text_type(message['To']),
                      '[email protected], [email protected]')
예제 #5
0
    def test_extra_headers(self):

        from pyramid_mailer.message import Message

        msg = Message(subject="testing",
                      sender="*****@*****.**",
                      recipients=["*****@*****.**"],
                      body="testing",
                      extra_headers=[('X-Foo', 'Joe')])

        response = msg.to_message()
        self.assertTrue("X-Foo: Joe" in text_type(response))
예제 #6
0
    def test_message_is_quoted_printable_with_text_body(self):
        from pyramid_mailer.message import Message

        msg = Message(
            recipients=['*****@*****.**'],
            subject="testing",
            sender="*****@*****.**",
            body="THISSHOULDBEINMESSAGEBODY",
            )

        response = msg.to_message()
        self.assertTrue("THISSHOULDBEINMESSAGEBODY" in text_type(response))
예제 #7
0
 def test_to_message_multiple_to_recipients(self):
     from pyramid_mailer.message import Message
     response = Message(
         subject="Subject",
         sender="From",
         recipients=["*****@*****.**", "*****@*****.**"],
         body="Body",
         html="Html",
         )
     message = response.to_message()
     self.assertEqual(text_type(message['To']),
                      '[email protected], [email protected]')
예제 #8
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.to_message()

        self.assertFalse("Bcc: [email protected]" in text_type(response))
        self.assertTrue(msgid)
예제 #9
0
    def test_extra_headers(self):

        from pyramid_mailer.message import Message

        msg = Message(
            subject="testing",
            sender="*****@*****.**",
            recipients=["*****@*****.**"],
            body="testing",
            extra_headers=[('X-Foo', 'Joe')]
            )

        response = msg.to_message()
        self.assertTrue("X-Foo: Joe" in text_type(response))
예제 #10
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.to_message()

        self.assertFalse(
            "Bcc: [email protected]" in text_type(response))
        self.assertTrue(msgid)
예제 #11
0
 def test_data_from_file_obj(self):
     a = self._makeOne(data=StringIO(text_type("foo")))
     self.assertEqual(a.data, "foo")
예제 #12
0
 def test_data_from_file_obj(self):
     a = self._makeOne(data=StringIO(text_type("foo")))
     self.assertEqual(a.data, "foo")