[REF] test_mass_mailing: use odoo test helper method to create test users
Purpose of this commit is to use the newly introduced helper to create test users in a quick way and reduce code duplication. This commit is linked to task ID 1889703 and PR #27526.
This commit is contained in:
@@ -1,36 +1,27 @@
|
||||
# -*- 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
|
||||
|
||||
|
||||
class TestResponsiveMail(common.SavepointCase):
|
||||
class TestComposer(common.SavepointCase):
|
||||
|
||||
def test_responsive_mail(self):
|
||||
def test_body_responsive(self):
|
||||
""" Testing mail mailing responsive mail body """
|
||||
self.user_employee = self.env['res.users'].with_context({
|
||||
'mail_create_nolog': True,
|
||||
'mail_create_nosubscribe': True,
|
||||
'mail_notrack': True,
|
||||
'no_reset_password': True,
|
||||
}).create({
|
||||
'name': 'Geraldine Mass Mailing User',
|
||||
'login': 'geraldine',
|
||||
'email': 'g.g@example.com',
|
||||
'groups_id': [(6, 0, [
|
||||
self.env.ref('mass_mailing.group_mass_mailing_user').id,
|
||||
self.env.ref('base.group_partner_manager').id, # TDE FIXME: check if really necessary for mass mailing
|
||||
])],
|
||||
})
|
||||
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['mail.mass_mailing'].sudo(self.user_employee).create({
|
||||
mass_mail_record = self.env['mail.mass_mailing'].sudo(test_user).create({
|
||||
'name': 'Test',
|
||||
'state': 'draft',
|
||||
'mailing_model_id': self.env.ref('base.model_res_partner').id,
|
||||
})
|
||||
|
||||
composer = self.env['mail.compose.message'].sudo(self.user_employee).with_context({
|
||||
composer = self.env['mail.compose.message'].sudo(test_user).with_context({
|
||||
'default_composition_mode': 'mass_mail',
|
||||
'default_model': 'res.partner',
|
||||
'default_res_id': test_record.id,
|
||||
|
||||
Reference in New Issue
Block a user