mirror of
https://gitlab.com/flectra-hq/flectra.git
synced 2026-10-25 07:27:39 -05:00
Merge branch 'master-upstream-patch-12092023' into 'master'
[PATCH] Upstream patch - 12092023 See merge request flectra-hq/flectra!1133
This commit is contained in:
commit
5f5e89aab6
2 files changed
+12
-2
No files matched your search
@@ -1814,7 +1814,7 @@ class MailThread(models.AbstractModel):
|
||||
node.set('src', '/web/image/%s?access_token=%s' % attachment_data)
|
||||
postprocessed = True
|
||||
if postprocessed:
|
||||
return_values['body'] = lxml.html.tostring(root, pretty_print=False, encoding='UTF-8')
|
||||
return_values['body'] = lxml.html.tostring(root, pretty_print=False, encoding='unicode')
|
||||
return_values['attachment_ids'] = m2m_attachment_ids
|
||||
return return_values
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ from unittest.mock import DEFAULT
|
||||
from unittest.mock import patch
|
||||
|
||||
from flectra import exceptions
|
||||
from flectra.addons.mail.models.mail_thread import MailThread
|
||||
from flectra.addons.mail.tests.common import mail_new_test_user
|
||||
from flectra.addons.test_mail.data import test_mail_data
|
||||
from flectra.addons.test_mail.data.test_mail_data import MAIL_TEMPLATE
|
||||
@@ -330,7 +331,16 @@ class TestMailgateway(TestMailCommon):
|
||||
|
||||
@mute_logger('flectra.addons.mail.models.mail_thread')
|
||||
def test_message_process_cid(self):
|
||||
record = self.format_and_process(test_mail_data.MAIL_MULTIPART_IMAGE, self.email_from, 'groups@test.com')
|
||||
origin_message_parse_extract_payload = MailThread._message_parse_extract_payload
|
||||
|
||||
def _message_parse_extract_payload(this, *args, **kwargs):
|
||||
res = origin_message_parse_extract_payload(this, *args, **kwargs)
|
||||
self.assertTrue(isinstance(res['body'], str), 'Body from extracted payload should still be a string.')
|
||||
return res
|
||||
|
||||
with patch.object(MailThread, '_message_parse_extract_payload', _message_parse_extract_payload):
|
||||
record = self.format_and_process(test_mail_data.MAIL_MULTIPART_IMAGE, self.email_from, 'groups@test.com')
|
||||
|
||||
message = record.message_ids[0]
|
||||
for attachment in message.attachment_ids:
|
||||
self.assertIn('/web/image/%s' % attachment.id, message.body)
|
||||
|
||||
Reference in new issue
Block a user