summaryrefslogtreecommitdiff
path: root/addons/test_mass_mailing/tests/common.py
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2020-08-05 09:13:12 +0000
committerThibault Delavallée <tde@odoo.com>2020-08-05 13:55:04 +0000
commitc1865706b06a6cea7f37ba4c8d962e374edfab83 (patch)
treece1f766f572344b4c2d4c04a0718393220b645bc /addons/test_mass_mailing/tests/common.py
parented4846dd9df32aa97ba2bf73ac772428d4237f25 (diff)
[FIX] test_mail_full, test_mass_mailing: fix some tool methods
Small improvements / fixes in tool methods used in python unit tests. Task ID-2239327 Task ID-2239327 PR #49886
Diffstat (limited to 'addons/test_mass_mailing/tests/common.py')
-rw-r--r--addons/test_mass_mailing/tests/common.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/test_mass_mailing/tests/common.py b/addons/test_mass_mailing/tests/common.py
index 22c3be91464..84f04bb29b1 100644
--- a/addons/test_mass_mailing/tests/common.py
+++ b/addons/test_mass_mailing/tests/common.py
@@ -25,9 +25,12 @@ class TestMassMailCommon(MassMailCommon, TestMailCommon):
@classmethod
def _create_test_blacklist_records(cls, model='mailing.test.blacklist', count=1):
""" Helper to create data. Currently simple, to be improved. """
+ Model = cls.env[model]
+ email_field = 'email' if 'email' in Model else 'email_from'
+
records = cls.env[model].create([{
'name': 'TestRecord_%02d' % x,
- 'email_from': '"TestCustomer %02d" <test.record.%02d@test.example.com>' % (x, x),
+ email_field: '"TestCustomer %02d" <test.record.%02d@test.example.com>' % (x, x),
} for x in range(0, count)])
return records