diff options
| author | Thibault Delavallée <tde@odoo.com> | 2019-10-21 12:51:32 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-11-26 08:45:55 +0000 |
| commit | def98d2375a8a906092293f0aa1ce03bf948d2d3 (patch) | |
| tree | 2136ce434aa8ba5912f8bf3dd39bea8c71dd2909 /addons/test_mail/tests/common.py | |
| parent | 8c0e92cdcdf98daa3c841af97e0bd2e4b015a1b9 (diff) | |
[IMP] test_mail: add new mail composer tests for its internals
Purpose is to have some low level tests for composer itself allowing to
ensure its behavior. We add tests notably about default values computation
in mass mailing mode as well as template_id change and values synchronization
in composer model.
In a near future composer will probably be improved (use computed fields,
rewrite part of its logic to improve performances). Having tests done before
those tasks ensure we notice every change that might happen.
Task ID-2390314
PR odoo/odoo#62061
Diffstat (limited to 'addons/test_mail/tests/common.py')
| -rw-r--r-- | addons/test_mail/tests/common.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/addons/test_mail/tests/common.py b/addons/test_mail/tests/common.py index b62b1a444aa..c556a988367 100644 --- a/addons/test_mail/tests/common.py +++ b/addons/test_mail/tests/common.py @@ -12,6 +12,29 @@ class TestMailCommon(MailCommon): def _create_channel_listener(cls): cls.channel_listen = cls.env['mail.channel'].with_context(cls._test_context).create({'name': 'Listener'}) + @classmethod + def _create_records_for_batch(cls, model, count): + # TDE note: to be cleaned in master + records = cls.env[model] + partners = cls.env['res.partner'] + country_id = cls.env.ref('base.be').id + + partners = cls.env['res.partner'].with_context(**cls._test_context).create([{ + 'name': 'Partner_%s' % (x), + 'email': '_test_partner_%s@example.com' % (x), + 'country_id': country_id, + 'mobile': '047500%02d%02d' % (x, x) + } for x in range(count)]) + + records = cls.env[model].with_context(**cls._test_context).create([{ + 'name': 'Test_%s' % (x), + 'customer_id': partners[x].id, + } for x in range(count)]) + + cls.records = cls._reset_mail_context(records) + cls.partners = partners + return cls.records, cls.partners + class TestMailMultiCompanyCommon(MailCommon): |
