From e0cbb058e5f8305e357680edd88d62ff085f964d Mon Sep 17 00:00:00 2001 From: Damien Bouvy <dbo@odoo.com> Date: Wed, 12 Oct 2016 12:00:02 +0200 Subject: [PATCH] [IMP] mail: add basic for update notification (ping) Ensures no regression on a3509d282d59b38e9b4c032c287e1d779000ba64 --- addons/mail/tests/__init__.py | 1 + addons/mail/tests/test_update_notification.py | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 addons/mail/tests/test_update_notification.py diff --git a/addons/mail/tests/__init__.py b/addons/mail/tests/__init__.py index 413ea870c3c5..1ff431bd6335 100644 --- a/addons/mail/tests/__init__.py +++ b/addons/mail/tests/__init__.py @@ -10,3 +10,4 @@ import test_message_track import test_mail_template import test_invite import test_ir_actions +import test_update_notification diff --git a/addons/mail/tests/test_update_notification.py b/addons/mail/tests/test_update_notification.py new file mode 100644 index 000000000000..7621e4056a11 --- /dev/null +++ b/addons/mail/tests/test_update_notification.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +from odoo.tests.common import TransactionCase + + +class TestUpdateNotification(TransactionCase): + def test_user_count(self): + ping_msg = self.env['publisher_warranty.contract'].with_context(active_test=False)._get_message() + user_count = self.env['res.users'].search_count([('active', '=', True)]) + self.assertEqual(ping_msg.get('nbr_users'), user_count, 'Update Notification: Users count is badly computed in ping message') + share_user_count = self.env['res.users'].search_count([('active', '=', True), ('share', '=', True)]) + self.assertEqual(ping_msg.get('nbr_share_users'), share_user_count, 'Update Notification: Portal Users count is badly computed in ping message') -- GitLab