Exemplo n.º 1
0
    def test_get_body_properly_handles_unicode_body(self):
        with open(os.path.join(os.path.dirname(__file__), "messages/generic_message.eml")) as f:
            unicode_body = six.u(f.read())

        message = Message()
        message.body = unicode_body

        expected_body = unicode_body
        actual_body = message.get_email_object().as_string()

        self.assertEqual(expected_body, actual_body)
Exemplo n.º 2
0
    def test_get_text_body_properly_recomposes_line_continuations(self):
        message = Message()
        email_object = self._get_email_object(
            'message_with_long_text_lines.eml')

        message.get_email_object = lambda: email_object

        actual_text = message.text
        expected_text = ('The one of us with a bike pump is far ahead, '
                         'but a man stopped to help us and gave us his pump.')

        self.assertEqual(actual_text, expected_text)
Exemplo n.º 3
0
    def test_get_text_body_properly_recomposes_line_continuations(self):
        message = Message()
        email_object = self._get_email_object("message_with_long_text_lines.eml")

        message.get_email_object = lambda: email_object

        actual_text = message.text
        expected_text = (
            "The one of us with a bike pump is far ahead, " "but a man stopped to help us and gave us his pump."
        )

        self.assertEqual(actual_text, expected_text)
Exemplo n.º 4
0
    def test_get_text_body_properly_recomposes_line_continuations(self):
        message = Message()
        email_object = self._get_email_object(
            'message_with_long_text_lines.eml'
        )

        self.mimic.stub_out_with_mock(message, 'get_email_object')
        message.get_email_object().and_return(email_object)

        self.mimic.replay_all()

        actual_text = message.get_text_body()
        expected_text = (
            u'The one of us with a bike pump is far ahead, '
            u'but a man stopped to help us and gave us his pump.'
        )

        self.assertEquals(
            actual_text,
            expected_text
        )
Exemplo n.º 5
0
    def test_get_body_properly_handles_unicode_body(self):
        with open(
                os.path.join(os.path.dirname(__file__),
                             'messages/generic_message.eml')) as f:
            unicode_body = six.u(f.read())

        message = Message()
        message.body = unicode_body

        expected_body = unicode_body
        actual_body = message.get_email_object().as_string()

        self.assertEqual(expected_body, actual_body)