[FIX] test_mail: make tests reproducible and independent from bus state
Some tests are currently dependent on bus state when computing number of notifications sent. For example install Crm then test_mail_full. Some tests crash as too much notifications are found in the bus. We therefore clean remaining bus notifications before running tests to ensure we check notifications during test itself. This make tests more easy to reproduce. Task ID-2390314 PR #62061 X-original-commit: 92ff1379b0492765fd0ba9863a9ce13fba7eeb4a
This commit is contained in:
@@ -79,6 +79,7 @@ class TestMailResend(TestMailCommon):
|
||||
@mute_logger('odoo.addons.mail.models.mail_mail')
|
||||
def test_remove_mail_become_canceled(self):
|
||||
# two failure sent on bus, one for each mail
|
||||
self._reset_bus()
|
||||
with self.mock_mail_gateway(), self.assertBus([(self.cr.dbname, 'res.partner', self.partner_admin.id)] * 2):
|
||||
message = self.test_record.with_user(self.user_admin).message_post(partner_ids=self.partners.ids, subtype_xmlid='mail.mt_comment', message_type='notification')
|
||||
|
||||
@@ -101,6 +102,7 @@ class TestMailResend(TestMailCommon):
|
||||
|
||||
@mute_logger('odoo.addons.mail.models.mail_mail')
|
||||
def test_cancel_all(self):
|
||||
self._reset_bus()
|
||||
with self.mock_mail_gateway(), self.assertBus([(self.cr.dbname, 'res.partner', self.partner_admin.id)] * 2):
|
||||
message = self.test_record.with_user(self.user_admin).message_post(partner_ids=self.partners.ids, subtype_xmlid='mail.mt_comment', message_type='notification')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user