From c1865706b06a6cea7f37ba4c8d962e374edfab83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 5 Aug 2020 09:13:12 +0000 Subject: [PATCH] [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 --- addons/test_mail_full/tests/common.py | 2 +- addons/test_mass_mailing/tests/common.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/test_mail_full/tests/common.py b/addons/test_mail_full/tests/common.py index 1f75394df99..10b2528b5ce 100644 --- a/addons/test_mail_full/tests/common.py +++ b/addons/test_mail_full/tests/common.py @@ -10,7 +10,7 @@ class TestMailFullCommon(TestMassMailCommon, MassSMSCommon): @classmethod def _create_records_for_batch(cls, model, count): - records = cls.env['mail.test.sms'] + records = cls.env[model] partners = cls.env['res.partner'] country_id = cls.env.ref('base.be').id, for x in range(count): 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" ' % (x, x), + email_field: '"TestCustomer %02d" ' % (x, x), } for x in range(0, count)]) return records