Skip to content
Permalink
Browse files

[MERGE] forward port branch saas-14 up to 3c7be1e

  • Loading branch information...
KangOl committed Mar 25, 2019
2 parents 48e4c18 + 3c7be1e commit 6cd6d1d468b55e613affbc6dd7eaafb6af4a994f
Showing with 14 additions and 14 deletions.
  1. +4 −4 addons/mail/tests/test_mail_gateway.py
  2. +10 −10 addons/mail/tests/test_mail_message.py
@@ -740,7 +740,7 @@ def test_private_discussion(self):
self.assertEqual(msg.model, False,
'message_post: private discussion: context key "thread_model" not correctly ignored when having no res_id')
# Test: message-id
self.assertIn('openerp-private', msg.message_id, 'message_post: private discussion: message-id should contain the private keyword')
self.assertIn('openerp-private', msg.message_id.split('@')[0], 'message_post: private discussion: message-id should contain the private keyword')

# Do: Bert replies through mailgateway (is a customer)
self.format_and_process(
@@ -768,9 +768,9 @@ def test_private_discussion(self):
@mute_logger('odoo.addons.mail.models.mail_thread', 'odoo.models', 'odoo.addons.mail.models.mail_mail')
def test_forward_parent_id(self):
msg = self.test_pigs.sudo(self.user_employee).message_post(no_auto_thread=True, subtype='mail.mt_comment')
self.assertNotIn(msg.model, msg.message_id)
self.assertNotIn('-%d-' % msg.res_id, msg.message_id)
self.assertIn('reply_to', msg.message_id)
self.assertNotIn(msg.model, msg.message_id.split('@')[0])
self.assertNotIn('-%d-' % msg.res_id, msg.message_id.split('@')[0])
self.assertIn('reply_to', msg.message_id.split('@')[0])

# forward it to a new thread AND an existing thread
fw_msg_id = '<THIS.IS.A.FW.MESSAGE.1@bert.fr>'
@@ -17,15 +17,15 @@ def test_mail_message_values_basic(self):
'reply_to': 'test.reply@example.com',
'email_from': 'test.from@example.com',
})
self.assertIn('-private', msg.message_id, 'mail_message: message_id for a void message should be a "private" one')
self.assertIn('-private', msg.message_id.split('@')[0], 'mail_message: message_id for a void message should be a "private" one')
self.assertEqual(msg.reply_to, 'test.reply@example.com')
self.assertEqual(msg.email_from, 'test.from@example.com')

def test_mail_message_values_default(self):
self.env['ir.config_parameter'].search([('key', '=', 'mail.catchall.domain')]).unlink()

msg = self.env['mail.message'].sudo(self.user_employee).create({})
self.assertIn('-private', msg.message_id, 'mail_message: message_id for a void message should be a "private" one')
self.assertIn('-private', msg.message_id.split('@')[0], 'mail_message: message_id for a void message should be a "private" one')
self.assertEqual(msg.reply_to, '%s <%s>' % (self.user_employee.name, self.user_employee.email))
self.assertEqual(msg.email_from, '%s <%s>' % (self.user_employee.name, self.user_employee.email))

@@ -35,7 +35,7 @@ def test_mail_message_values_alias(self):
self.env['ir.config_parameter'].search([('key', '=', 'mail.catchall.alias')]).unlink()

msg = self.env['mail.message'].sudo(self.user_employee).create({})
self.assertIn('-private', msg.message_id, 'mail_message: message_id for a void message should be a "private" one')
self.assertIn('-private', msg.message_id.split('@')[0], 'mail_message: message_id for a void message should be a "private" one')
self.assertEqual(msg.reply_to, '%s <%s>' % (self.user_employee.name, self.user_employee.email))
self.assertEqual(msg.email_from, '%s <%s>' % (self.user_employee.name, self.user_employee.email))

@@ -46,7 +46,7 @@ def test_mail_message_values_alias_catchall(self):
self.env['ir.config_parameter'].set_param('mail.catchall.alias', alias_catchall)

msg = self.env['mail.message'].sudo(self.user_employee).create({})
self.assertIn('-private', msg.message_id, 'mail_message: message_id for a void message should be a "private" one')
self.assertIn('-private', msg.message_id.split('@')[0], 'mail_message: message_id for a void message should be a "private" one')
self.assertEqual(msg.reply_to, '%s <%s@%s>' % (self.env.user.company_id.name, alias_catchall, alias_domain))
self.assertEqual(msg.email_from, '%s <%s>' % (self.user_employee.name, self.user_employee.email))

@@ -57,7 +57,7 @@ def test_mail_message_values_document_no_alias(self):
'model': 'mail.test',
'res_id': self.test_pigs.id
})
self.assertIn('-openerp-%d-mail.test' % self.test_pigs.id, msg.message_id, 'mail_message: message_id for a void message should be a "private" one')
self.assertIn('-openerp-%d-mail.test' % self.test_pigs.id, msg.message_id.split('@')[0], 'mail_message: message_id for a void message should be a "private" one')
self.assertEqual(msg.reply_to, '%s <%s>' % (self.user_employee.name, self.user_employee.email))
self.assertEqual(msg.email_from, '%s <%s>' % (self.user_employee.name, self.user_employee.email))

@@ -70,7 +70,7 @@ def test_mail_message_values_document_alias(self):
'model': 'mail.test',
'res_id': self.test_pigs.id
})
self.assertIn('-openerp-%d-mail.test' % self.test_pigs.id, msg.message_id, 'mail_message: message_id for a void message should be a "private" one')
self.assertIn('-openerp-%d-mail.test' % self.test_pigs.id, msg.message_id.split('@')[0], 'mail_message: message_id for a void message should be a "private" one')
self.assertEqual(msg.reply_to, '%s %s <%s@%s>' % (self.env.user.company_id.name, self.test_pigs.name, self.test_pigs.alias_name, alias_domain))
self.assertEqual(msg.email_from, '%s <%s>' % (self.user_employee.name, self.user_employee.email))

@@ -84,7 +84,7 @@ def test_mail_message_values_document_alias_catchall(self):
'model': 'mail.test',
'res_id': self.test_pigs.id
})
self.assertIn('-openerp-%d-mail.test' % self.test_pigs.id, msg.message_id, 'mail_message: message_id for a void message should be a "private" one')
self.assertIn('-openerp-%d-mail.test' % self.test_pigs.id, msg.message_id.split('@')[0], 'mail_message: message_id for a void message should be a "private" one')
self.assertEqual(msg.reply_to, '%s %s <%s@%s>' % (self.env.user.company_id.name, self.test_pigs.name, self.test_pigs.alias_name, alias_domain))
self.assertEqual(msg.email_from, '%s <%s>' % (self.user_employee.name, self.user_employee.email))

@@ -94,9 +94,9 @@ def test_mail_message_values_no_auto_thread(self):
'res_id': self.test_pigs.id,
'no_auto_thread': True,
})
self.assertIn('reply_to', msg.message_id)
self.assertNotIn('mail.test', msg.message_id)
self.assertNotIn('-%d-' % self.test_pigs.id, msg.message_id)
self.assertIn('reply_to', msg.message_id.split('@')[0])
self.assertNotIn('mail.test', msg.message_id.split('@')[0])
self.assertNotIn('-%d-' % self.test_pigs.id, msg.message_id.split('@')[0])

def test_mail_message_notify_from_mail_mail(self):
# Due ot post-commit hooks, store send emails in every step

0 comments on commit 6cd6d1d

Please sign in to comment.
You can’t perform that action at this time.