[MIG] web_notify: Migration to 12.0

Add self-test buttons in demo environment,
Updated readme to show how to test it.
Add buttons to users form
Do not rely on SUPERUSER_ID and avoid getattr usage
This commit is contained in:
Aitor Bouzas
2018-10-10 10:37:35 +02:00
committed by David
parent d21c87f525
commit 9cd5f5b981
17 changed files with 641 additions and 75 deletions

View File

@@ -1 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import test_res_users

View File

@@ -43,7 +43,7 @@ class TestResUsers(common.TransactionCase):
) as mockedSendMany:
users = self.env.user.search([(1, "=", 1)])
self.assertTrue(len(users) > 1)
users.notify_warning('message')
users.notify_warning(message='message')
self.assertEqual(1, mockedSendMany.call_count)
@@ -61,8 +61,8 @@ class TestResUsers(common.TransactionCase):
other_user = self.env.ref('base.user_demo')
other_user_model = self.env['res.users'].sudo(other_user)
with self.assertRaises(exceptions.UserError):
other_user_model.browse(self.env.uid).notify_info('hello')
other_user_model.browse(self.env.uid).notify_info(message='hello')
def test_notify_admin_allowed_other_user(self):
other_user = self.env.ref('base.user_demo')
other_user.notify_info('hello')
other_user.notify_info(message='hello')