summaryrefslogtreecommitdiff
path: root/addons/event_sms
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2021-04-16 11:52:45 +0000
committerThibault Delavallée <tde@odoo.com>2021-04-19 14:11:13 +0000
commite77b9e575e398f42df524bdaf5d692ea882a4521 (patch)
treedd846e1a25aea75549126c77fd7504caa79e4c25 /addons/event_sms
parent509d761921167a041bfe5dd403181d399c20dacc (diff)
[IMP] event_sms, link_tracker, sms, test_mail_full: improve SMS-based mailing tests
PURPOSE Purpose is to have more tests when sending sms mailings, notably about canceled or failed mails or sms as well as jinja and links rendering. SPECIFICATIONS In this commit we improve SMS Marketing mailing tests. We notably * add tests for void and invalid email and numbers. It allows to check they correctly update their trace status; * add tests for unsubscribe and view links embedded in sms marketing; * add tests to simulate a click on links sent through sms marketing and ensure click statistics are effectively updated; * ensure content of sent sms are checked; Default content of mailings used in test is updated to ensure jinja is correctly rendered, including links and some corner cases. This will also helps ensuring behavior is kept when converting to QWeb. In event we now correctly use sms gateway mock to ensure SMS finding. In link_tracker a helper is added to check url tracking in plaintext content. LINKS Task ID-2508643 Followup of odoo/odoo#68874 (improve mail tests) Prepares Task ID-27033 (support QWeb in templates) Prepares Task ID-2377974 (clean trace and status management in mass mailing) COM PR odoo/odoo#69461 ENT PR odoo/enterprise#17780
Diffstat (limited to 'addons/event_sms')
-rw-r--r--addons/event_sms/tests/test_sms_schedule.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/addons/event_sms/tests/test_sms_schedule.py b/addons/event_sms/tests/test_sms_schedule.py
index 3b592d61b5a..b32e939b69f 100644
--- a/addons/event_sms/tests/test_sms_schedule.py
+++ b/addons/event_sms/tests/test_sms_schedule.py
@@ -44,7 +44,8 @@ class TestSMSSchedule(TestEventCommon, SMSCase):
})
def test_sms_schedule(self):
- self._create_registrations(self.event_0, 3)
+ with self.mockSMSGateway():
+ self._create_registrations(self.event_0, 3)
# check subscription scheduler
schedulers = self.env['event.mail'].search([('event_id', '=', self.event_0.id), ('interval_type', '=', 'after_sub')])
@@ -59,7 +60,9 @@ class TestSMSSchedule(TestEventCommon, SMSCase):
for registration in self.event_0.registration_ids:
reg_sanitized_number = phone_validation.phone_format(registration.phone, 'BE', '32', force_format='E164')
sanitized_numbers.append(reg_sanitized_number)
- self.assertSMSOutgoing(self.env['res.partner'], reg_sanitized_number, '%s registration confirmation.' % self.event_0.organizer_id.name)
+ self.assertSMSOutgoing(
+ self.env['res.partner'], reg_sanitized_number,
+ content='%s registration confirmation.' % self.event_0.organizer_id.name)
# clear notification queue to avoid conflicts when checking next notifications
self.env['mail.notification'].search([('sms_number', 'in', sanitized_numbers)]).unlink()
@@ -71,9 +74,12 @@ class TestSMSSchedule(TestEventCommon, SMSCase):
self.assertEqual(schedulers[0].scheduled_date, self.event_0.date_begin + relativedelta(days=-3))
# execute event reminder scheduler explicitly
- schedulers.execute()
+ with self.mockSMSGateway():
+ schedulers.execute()
# verify that subscription scheduler was auto-executed after each registration
for registration in self.event_0.registration_ids:
reg_sanitized_number = phone_validation.phone_format(registration.phone, 'BE', '32', force_format='E164')
- self.assertSMSOutgoing(self.env['res.partner'], reg_sanitized_number, '%s reminder' % self.event_0.organizer_id.name)
+ self.assertSMSOutgoing(
+ self.env['res.partner'], reg_sanitized_number,
+ content='%s reminder' % self.event_0.organizer_id.name)