You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
# -*- coding: utf-8 -*-
################################################################################### # # Copyright (C) 2017 MuK IT GmbH # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ###################################################################################
import base64 import unittest
from odoo import _ from odoo.tests import common
from .. import controllers
class MailParseTestCase(common.TransactionCase): at_install = False post_install = True def setUp(self): super(MailParseTestCase, self).setUp() self.attachment_model = self.env['ir.attachment'].sudo() self.sample_mail_attachment = self.attachment_model.create({ 'name': 'SampleMail', 'datas': base64.encodestring("""
Return-Path: <mlemos@acm.org> To: Manuel Lemos <mlemos@linux.local> Subject: Testing Manuel Lemos' MIME E-mail composing and sending PHP class: HTML message From: mlemos <mlemos@acm.org> Reply-To: mlemos <mlemos@acm.org> Sender: mlemos@acm.org X-Mailer: http://www.phpclasses.org/mimemessage $Revision: 1.63 $ (mail) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="652b8c4dcb00cdcdda1e16af36781caf" Message-ID: <20050430192829.0489.mlemos@acm.org> Date: Sat, 30 Apr 2005 19:28:29 -0300 --652b8c4dcb00cdcdda1e16af36781caf Content-Type: multipart/related; boundary="6a82fb459dcaacd40ab3404529e808dc" --6a82fb459dcaacd40ab3404529e808dc Content-Type: multipart/alternative; boundary="69c1683a3ee16ef7cf16edd700694a2f" --69c1683a3ee16ef7cf16edd700694a2f Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable This is an HTML message. Please use an HTML capable mail program to read this message. --69c1683a3ee16ef7cf16edd700694a2f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <html> <head> <title>Testing Manuel Lemos' MIME E-mail composing and sending PHP class: H= TML message</title> <style type=3D"text/css"><!-- body { color: black ; font-family: arial, helvetica, sans-serif ; backgroun= d-color: #A3C5CC } A:link, A:visited, A:active { text-decoration: underline } --></style> </head> <body> <table background=3D"cid:4c837ed463ad29c820668e835a270e8a.gif" width=3D"100= %"> <tr> <td> <center><h1>Testing Manuel Lemos' MIME E-mail composing and sending PHP cla= ss: HTML message</h1></center> <hr> <P>Hello Manuel,<br><br> This message is just to let you know that the <a href=3D"http://www.phpclas= ses.org/mimemessage">MIME E-mail message composing and sending PHP class</a= > is working as expected.<br><br> <center><h2>Here is an image embedded in a message as a separate part:</h2>= </center> <center><img src=3D"cid:ae0357e57f04b8347f7621662cb63855.gif"></center>Than= k you,<br> mlemos</p> </td> </tr> </table> </body> </html> --69c1683a3ee16ef7cf16edd700694a2f-- --6a82fb459dcaacd40ab3404529e808dc Content-Type: image/gif; name="logo.gif" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="logo.gif" Content-ID: <ae0357e57f04b8347f7621662cb63855.gif> R0lGODlhlgAjAPMJAAAAAAAA/y8vLz8/P19fX19f339/f4+Pj4+Pz7+/v/////////////////// /////yH5BAEAAAkALAAAAACWACMAQwT+MMlJq7046827/2AoHYChGAChAkBylgKgKClFyEl6xDMg qLFBj3C5uXKplVAxIOxkA8BhdFCpDlMK1urMTrZWbAV8tVS5YsxtxmZHBVOSCcW9zaXyNhslVcto RBp5NQYxLAYGLi8oSwoJBlE+BiSNj5E/PDQsmy4pAJWQLAKJY5+hXhZ2dDYldFWtNSFPiXssXnZR k5+1pjpBiDMJUXG/Jo7DI4eKfMSmxsJ9GAUB1NXW19jZ2tvc3d7f4OHi2AgZN5vom1kk6F7s6u/p m3Ab7AOIiCxOyZuBIv8AOeTJIaYQjiR/kKTr5GQNE3pYSjCJ9mUXClRUsLxaZGciC0X+OlpoOuQo ZKdNJnIoKfnxRUQh6FLG0iLxIoYnJd0JEKISJ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QAAOw== --6a82fb459dcaacd40ab3404529e808dc Content-Type: image/gif; name="background.gif" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="background.gif" Content-ID: <4c837ed463ad29c820668e835a270e8a.gif> R0lGODlh+wHCAPMAAKPFzKLEy6HDyqHCyaDByJ/Ax56/xp2+xZ28xJy7w5u6wpq5wZm4wJm3v5i2 vpe1vSwAAAAA+wHCAEME/hDISau9OOvNu/9gKI5kaZ5oqq5s675wLM90bd94ru987//AoHBILBqP yKRyyWw6n9CodEqtWq+gwSHReHgfjobY8X00FIc019tIHAYS7dqcQCDm3vC4fD4QAhUBBFsMZF8O hnkLCAYFW11tb1iTlJWWOXJdZZtmC24Eg3hgYntfbXainJ2fgBSZbG5wFAG0E6+RoAZ3CbwJCgya p3cMbAyevQcFAgMGCcRmxr1uyszOxQq+wF4MdcPFx7zJApfk5eYhr3SSGemRsu3dc+4iAqELhZwO 0X6hkHUHCBRoGtUg0RkEAAUeKhhGAcICBQIODIPooIEBzCTmKcjGYSNd/go3VvQo65zJkyhTqlzJ sqXLlzBjypxJs6bNmzhz6tzJs6fPn0CDCh1KtKjRo0iTKl3KtKnTp1CXBhhAwECaq1gPNCIwANDU qmkMcG311apWULmyZt3alcPXAma1FgAlgCxVq2LbRt3LF0Y7hwWoEjLEDZUmff8AOjMkTB5gwYu3 JbhIQUDEZw+4+aE1aNc0R2vcDYjoDBgpBoUDj95yzzRqbH7qgW4t5vUnAfVAoj7NwOOf1QloN7Ad u1Xf41b+IlCNsa6rR7DWwTPccTnG5sYvCEKwgPGiZI64A9OsK/Q/BM/0YfuFz13VOwsULLhHps+f 98Hl0zeDRk0X9Qih/vLPWPjFN197aPyB3IJVBLDMdc5t4OB1A0QowYQQ0vIgdilgyGEgG1roYV0j GufhhyBSWGF2s2yIYosqWsjgjDTWaOONOOao44489ujjj0AGKeSQRBZp5JFIJqnkkkw26eSTUMJU llpYseXVXWGNdSGWZ6EVF5VWukUVXFdtRUCEU+bFYpRslqNcYKHgk1k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W9HiCB2Q0Y3ic8k2Kl5V4JQhUiXgWFgqUh1e9h3mcpy2epxdm+XnjQ1EiMHoQ pVtogiWuV3urBxGod4Xnw41huJfjKHvtg3t8GYKEWZiGeZiImZiKuZiM2ZiO+ZiQGZmSOZmUWZmW eZmYmZmauZmc2ZlCEQEAOw== --6a82fb459dcaacd40ab3404529e808dc-- --652b8c4dcb00cdcdda1e16af36781caf Content-Type: text/plain; name="attachment.txt" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="attachment.txt" VGhpcyBpcyBqdXN0IGEgcGxhaW4gdGV4dCBhdHRhY2htZW50IGZpbGUgbmFtZWQgYXR0YWNobWVu dC50eHQgLg== --652b8c4dcb00cdcdda1e16af36781caf-- """)
})
def tearDown(self): super(MailParseTestCase, self).tearDown() def test_parse_mail(self): pass # FIXME # self.assertTrue(controllers.main.MailParserController().parse_mail('/web/content/%s?download=true' % self.sample_mail_attachment.id))
|