summaryrefslogtreecommitdiff
path: root/addons/test_mass_mailing/tests/test_composer.py
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2019-11-08 09:43:56 +0000
committerThibault Delavallée <tde@odoo.com>2019-11-20 16:01:06 +0000
commitb287504977e532fe2d178a4d62df6f9eb7a17f22 (patch)
tree32c6274f21e0b7f08a8e5887425e8d6efd26cfd0 /addons/test_mass_mailing/tests/test_composer.py
parent363bdc16c7f03ba0f323bc9afbf1878de44fa008 (diff)
[REF] test_mass_mailing: update module to new common
PURPOSE Currently tools and asserts for mail tests are located inside test_mail module. It makes difficult to re-use them in apps tests or force them to write custom quick and dirty tools and asserts. SPECIFICATIONS Update this module to new tools / asserts / helpers / classes defined in mail and test_mail. In this commit we remove the ``MassMailingCase`` and replace it by a fresh ``TestMailCommon`` that is simply updated to hold a marketing user by default. That way all mocks and asserts are available in all sub test classes. Coming from common update, we have notably * ``BaseFunctionalTest`` class is replaced by the new ``TestMailCommon`` pimped one; * ``assertNotifications`` is replaced by ``assertSinglePostNotifications`` (shortcut for a simple message_post) or ``assertPostNotifications`` (complete asserts involving several messages and notifications); * correctly invoke ``mock_mail_gateway`` when mocking email sending; * replace manual check of sent emails or ``assertEmails`` by ``assertSentEmails``; * remove custom mocks / checks and replace them by now standard mocks and assertions (if any); LINKS Task ID 2068986 PR #38070
Diffstat (limited to 'addons/test_mass_mailing/tests/test_composer.py')
-rw-r--r--addons/test_mass_mailing/tests/test_composer.py14
1 files changed, 4 insertions, 10 deletions
diff --git a/addons/test_mass_mailing/tests/test_composer.py b/addons/test_mass_mailing/tests/test_composer.py
index 4307bc95591..2b43e87e6d9 100644
--- a/addons/test_mass_mailing/tests/test_composer.py
+++ b/addons/test_mass_mailing/tests/test_composer.py
@@ -1,28 +1,22 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from odoo.addons.test_mail.tests.common import mail_new_test_user
-from odoo.tests import common
+from odoo.addons.test_mass_mailing.tests import common
-class TestComposer(common.SavepointCase):
+class TestComposer(common.TestMailCommon):
def test_body_responsive(self):
""" Testing mail mailing responsive mail body """
- test_user = mail_new_test_user(
- self.env, login='geraldine',
- groups='mass_mailing.group_mass_mailing_user,base.group_partner_manager' # TDE FIXME: check if really necessary for mass mailing
- )
-
test_record = self.env['res.partner'].create({'name': 'Mass Mail Partner'})
- mass_mail_record = self.env['mailing.mailing'].with_user(test_user).create({
+ mass_mail_record = self.env['mailing.mailing'].with_user(self.user_marketing).create({
'name': 'Test',
'subject': 'Test',
'state': 'draft',
'mailing_model_id': self.env.ref('base.model_res_partner').id,
})
- composer = self.env['mail.compose.message'].with_user(test_user).with_context({
+ composer = self.env['mail.compose.message'].with_user(self.user_marketing).with_context({
'default_composition_mode': 'mass_mail',
'default_model': 'res.partner',
'default_res_id': test_record.id,