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.
33 lines
1.2 KiB
33 lines
1.2 KiB
# -*- coding: utf-8 -*-
|
|
# Copyright 2018 Therp BV <https://therp.nl>
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
|
from openerp.tests.common import TransactionCase
|
|
|
|
|
|
class TestMailAutogeneratedHeader(TransactionCase):
|
|
def test_mail_autogenerated_header(self):
|
|
# sending
|
|
mail = self.env['mail.mail'].create({
|
|
'subject': 'testmessage',
|
|
'email_from': 'test@test.com',
|
|
'email_to': 'test@test.com',
|
|
'message_id': 'message_id',
|
|
})
|
|
message = self.env['ir.mail_server'].build_email(
|
|
[mail.email_from], [mail.email_to], mail.subject, '',
|
|
message_id=mail.message_id,
|
|
)
|
|
self.env['ir.mail_server'].send_email(message)
|
|
self.assertEqual(message['Auto-Submitted'], 'auto-generated')
|
|
|
|
# receiving
|
|
message.replace_header('Message-Id', 'message_id2')
|
|
thread_id = self.env['mail.thread'].message_process(
|
|
'res.partner', message.as_string(),
|
|
)
|
|
self.assertFalse(thread_id)
|
|
del message['Auto-Submitted']
|
|
thread_id = self.env['mail.thread'].message_process(
|
|
'res.partner', message.as_string(),
|
|
)
|
|
self.assertTrue(thread_id)
|