diff options
| author | Nicolas Lempereur <nle@odoo.com> | 2021-05-21 08:46:20 +0000 |
|---|---|---|
| committer | Nicolas Lempereur <nle@odoo.com> | 2021-05-26 11:23:28 +0000 |
| commit | 965c67cb16d2a4ac10d35a01da3af311867a47e6 (patch) | |
| tree | f75693ce6312c733ee78bd2867d912348812178c /addons/test_mass_mailing/tests/test_mailing.py | |
| parent | d53d8bdf789e8f79ea4d531d944686abb59d6a26 (diff) | |
[FIX] mail,test_mass_mailing: unblacklist with mass mailing
The optimization 2ccf0bd0dc does not take into account that to
"unblacklist" a user, you have the archive the mail.blacklist record so
only mail.blacklist active records need to be taken into account.
Added test without the fix fails with:
AssertionError: False is not true : MailTrace: email
test.record.02@test.example.com (recipient res.partner(), state:
sent, record: mailing.test.blacklist(166,)): found 0 records (1 expected)
opw-2536304
closes odoo/odoo#71239
X-original-commit: 8ffd82249728b79959cfa61490730991a2b339d6
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Diffstat (limited to 'addons/test_mass_mailing/tests/test_mailing.py')
| -rw-r--r-- | addons/test_mass_mailing/tests/test_mailing.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/addons/test_mass_mailing/tests/test_mailing.py b/addons/test_mass_mailing/tests/test_mailing.py index c5a90927df5..4f6fa34f8ee 100644 --- a/addons/test_mass_mailing/tests/test_mailing.py +++ b/addons/test_mass_mailing/tests/test_mailing.py @@ -225,10 +225,17 @@ class TestMassMailing(TestMassMailCommon): mailing = self.env['mailing.mailing'].browse(self.mailing_bl.ids) recipients = self._create_mailing_test_records(count=5) - # blacklist records 3 and 4 + # blacklist records 2, 3, 4 + self.env['mail.blacklist'].create({'email': recipients[2].email_normalized}) self.env['mail.blacklist'].create({'email': recipients[3].email_normalized}) self.env['mail.blacklist'].create({'email': recipients[4].email_normalized}) + # unblacklist record 2 + self.env['mail.blacklist'].action_remove_with_reason( + recipients[2].email_normalized, "human error" + ) + self.env['mail.blacklist'].flush(['active']) + mailing.write({'mailing_domain': [('id', 'in', recipients.ids)]}) mailing.action_put_in_queue() with self.mock_mail_gateway(mail_unlink_sent=False): |
