From f83f2d97d70cc8f4e5b9845a6138df5f5dd4d8be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Maes?= Date: Wed, 26 Aug 2015 14:45:53 +0200 Subject: [PATCH] [FIX] mail: disable tests mail.channel doesn't have the normal behavior of mail.thread, but the test are based on mail.channel (which is thus a not so good idea). res.partner is the other model available in mail module, implementing the correct behavior of mail.thread, but trigger AccessError. The tests are commented from now, since TDE and I rewrite the test with a complete module dedicated to the test and implementing the expected behavior of a mail.thread. --- addons/mail/tests/test_mail_features.py | 16 +++++++++------- addons/mail/tests/test_mail_gateway.py | 18 ++++++++++++------ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/addons/mail/tests/test_mail_features.py b/addons/mail/tests/test_mail_features.py index b59a76602b9..2766d0d7ced 100644 --- a/addons/mail/tests/test_mail_features.py +++ b/addons/mail/tests/test_mail_features.py @@ -48,13 +48,15 @@ class TestMessagePost(TestMail): self.assertEqual(self.group_pigs.message_follower_ids.mapped('partner_id'), original.mapped('partner_id')) self.assertEqual(self.group_pigs.message_follower_ids.mapped('channel_id'), original.mapped('channel_id')) - @mute_logger('openerp.addons.mail.models.mail_mail') - def test_post_subscribe_author(self): - original = self.group_pigs.message_follower_ids - self.group_pigs.sudo(self.user_employee).message_post( - body='Test Body', message_type='comment', subtype='mt_comment') - self.assertEqual(self.group_pigs.message_follower_ids.mapped('partner_id'), original.mapped('partner_id') | self.user_employee.partner_id) - self.assertEqual(self.group_pigs.message_follower_ids.mapped('channel_id'), original.mapped('channel_id')) + # TODO : the author of a message post on mail.channel should not be added as follower + + # @mute_logger('openerp.addons.mail.models.mail_mail') + # def test_post_subscribe_author(self): + # original = self.group_pigs.message_follower_ids + # self.group_pigs.sudo(self.user_employee).message_post( + # body='Test Body', message_type='comment', subtype='mt_comment') + # self.assertEqual(self.group_pigs.message_follower_ids.mapped('partner_id'), original.mapped('partner_id') | self.user_employee.partner_id) + # self.assertEqual(self.group_pigs.message_follower_ids.mapped('channel_id'), original.mapped('channel_id')) @mute_logger('openerp.addons.mail.models.mail_mail') def test_post_no_subscribe_recipients(self): diff --git a/addons/mail/tests/test_mail_gateway.py b/addons/mail/tests/test_mail_gateway.py index 6c1c1d76099..41ae67ba369 100644 --- a/addons/mail/tests/test_mail_gateway.py +++ b/addons/mail/tests/test_mail_gateway.py @@ -291,8 +291,10 @@ class TestMailgateway(TestMail): self.assertIn('Valid Lelitre ', new_groups.message_ids[0].email_from, 'message_process: recognized email -> email_from') - self.assertEqual(new_groups.message_partner_ids, self.partner_1, - 'message_process: recognized email -> added as follower') + # TODO : the author of a message post on mail.channel should not be added as follower + # FAIL ON recognized email -> added as follower') + # self.assertEqual(new_groups.message_partner_ids, self.partner_1, + # 'message_process: recognized email -> added as follower') self.assertEqual(len(self._mails), 0, 'message_process: no bounce or notificatoin email should be sent with follower = author') @@ -379,11 +381,15 @@ class TestMailgateway(TestMail): 'message_process: one email should have been generated') self.assertIn('valid.lelitre@agrolait.com', self._mails[0].get('email_to')[0], 'message_process: email should be sent to Sylvie') + + # TODO : the author of a message post on mail.channel should not be added as follower + # FAIL ON 'message_process: after reply, group should have 2 followers') ` AssertionError: res.partner(104,) != res.partner(104, 105) : message_process: after reply, group should have 2 followers + # Test: author (and not recipient) added as follower - self.assertEqual(self.group_public.message_partner_ids, self.partner_1 | self.partner_2, - 'message_process: after reply, group should have 2 followers') - self.assertEqual(self.group_public.message_channel_ids, self.env['mail.channel'], - 'message_process: after reply, group should have 2 followers (0 channels)') + # self.assertEqual(self.group_public.message_partner_ids, self.partner_1 | self.partner_2, + # 'message_process: after reply, group should have 2 followers') + # self.assertEqual(self.group_public.message_channel_ids, self.env['mail.channel'], + # 'message_process: after reply, group should have 2 followers (0 channels)') @mute_logger('openerp.addons.mail.models.mail_thread', 'openerp.models') def test_message_process_in_reply_to(self):