Ejemplo n.º 1
0
    def test_flatten(self):
        header_str = b"""\
From: [email protected]
To: [email protected]
To: [email protected]

""".replace(b'\n', b'\r\n')
        body_str = b'test test\r\n'
        env = Envelope()
        env.parse(header_str + body_str)
        ret_headers, ret_body = env.flatten()
        self.assertEqual(header_str, ret_headers)
        self.assertEqual(body_str, ret_body)
Ejemplo n.º 2
0
    def test_flatten(self):
        header_str = b"""\
From: [email protected]
To: [email protected]
To: [email protected]

""".replace(b'\n', b'\r\n')
        body_str = b'test test\r\n'
        env = Envelope()
        env.parse(header_str + body_str)
        ret_headers, ret_body = env.flatten()
        self.assertEqual(header_str, ret_headers)
        self.assertEqual(body_str, ret_body)
 def test_flatten(self):
     headers = Message()
     headers['From'] = '*****@*****.**'
     headers['To'] = '*****@*****.**'
     headers['To'] = '*****@*****.**'
     body = 'test test\r\n'
     env = Envelope(headers=headers, message=body)
     header_str = '\r\n'.join(['From: [email protected]',
                               'To: [email protected]',
                               'To: [email protected]',
                               '', ''])
     ret_headers, ret_body = env.flatten()
     assert_equal(header_str, ret_headers)
     assert_equal(body, ret_body)
Ejemplo n.º 4
0
 def test_flatten(self):
     headers = Message()
     headers['From'] = '*****@*****.**'
     headers['To'] = '*****@*****.**'
     headers['To'] = '*****@*****.**'
     body = 'test test\r\n'
     env = Envelope(headers=headers, message=body)
     header_str = '\r\n'.join([
         'From: [email protected]', 'To: [email protected]',
         'To: [email protected]', '', ''
     ])
     ret_headers, ret_body = env.flatten()
     self.assertEqual(header_str, ret_headers)
     self.assertEqual(body, ret_body)
 def test_encode_7bit_encoding(self):
     headers = Message()
     headers['From'] = '*****@*****.**'
     headers['To'] = '*****@*****.**'
     body = ''.join([chr(i) for i in range(129, 256)])
     env = Envelope(headers=headers, message=body)
     header_str = '\r\n'.join(['From: [email protected]',
                               'To: [email protected]',
                               'Content-Transfer-Encoding: base64',
                               '', ''])
     body_str = 'gYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5\nuru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy\n8/T19vf4+fr7/P3+/w=='
     env.encode_7bit(encoder=encode_base64)
     ret_headers, ret_body = env.flatten()
     assert_equal(header_str, ret_headers)
     assert_equal(body_str, ret_body)
Ejemplo n.º 6
0
 def test_encode_7bit_encoding(self):
     headers = Message()
     headers['From'] = '*****@*****.**'
     headers['To'] = '*****@*****.**'
     body = ''.join([chr(i) for i in range(129, 256)])
     env = Envelope(headers=headers, message=body)
     header_str = '\r\n'.join([
         'From: [email protected]', 'To: [email protected]',
         'Content-Transfer-Encoding: base64', '', ''
     ])
     body_str = 'gYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5\nuru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy\n8/T19vf4+fr7/P3+/w=='
     env.encode_7bit(encoder=encode_base64)
     ret_headers, ret_body = env.flatten()
     self.assertEqual(header_str, ret_headers)
     self.assertEqual(body_str, ret_body)
Ejemplo n.º 7
0
    def test_encode_7bit_encoding(self):
        headers = Message()
        headers['From'] = '*****@*****.**'
        headers['To'] = '*****@*****.**'
        body = bytes(bytearray(range(129, 256)))
        env = Envelope(headers=headers, message=body)
        header_str = b"""\
From: [email protected]
To: [email protected]
Content-Transfer-Encoding: base64

""".replace(b'\n', b'\r\n')
        body_str = b'gYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5\r\nuru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy\r\n8/T19vf4+fr7/P3+/w=='
        env.encode_7bit(encoder=encode_base64)
        ret_headers, ret_body = env.flatten()
        self.assertEqual(header_str, ret_headers)
        self.assertEqual(body_str, ret_body.rstrip())
Ejemplo n.º 8
0
    def test_encode_7bit_encoding(self):
        headers = Message()
        headers['From'] = '*****@*****.**'
        headers['To'] = '*****@*****.**'
        body = bytes(bytearray(range(129, 256)))
        env = Envelope(headers=headers, message=body)
        header_str = b"""\
From: [email protected]
To: [email protected]
Content-Transfer-Encoding: base64

""".replace(b'\n', b'\r\n')
        body_str = b'gYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5\r\nuru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy\r\n8/T19vf4+fr7/P3+/w=='
        env.encode_7bit(encoder=encode_base64)
        ret_headers, ret_body = env.flatten()
        self.assertEqual(header_str, ret_headers)
        self.assertEqual(body_str, ret_body.rstrip())