You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.1 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2017-today Onestein (<http://www.onestein.eu>)
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from odoo.tests.common import TransactionCase
  5. class TestWebShortcut(TransactionCase):
  6. def setUp(self, *args, **kwargs):
  7. super(TestWebShortcut, self).setUp(*args, **kwargs)
  8. self.shortcut_obj = self.env['web.shortcut']
  9. self.menu_obj = self.env['ir.ui.menu']
  10. self.menu = self.env.ref('base.menu_ir_property')
  11. self.user = self.env.ref('base.user_root')
  12. self.shortcut_obj.search([('user_id', '=', self.user.id)]).unlink()
  13. def test_web_shortcut(self):
  14. res = self.shortcut_obj.get_user_shortcuts()
  15. self.assertEqual(len(res), 0)
  16. self.shortcut_obj.create({
  17. 'name': 'Test',
  18. 'menu_id': self.menu.id,
  19. 'user_id': self.env.user.id
  20. })
  21. res = self.shortcut_obj.get_user_shortcuts()
  22. self.assertEqual(len(res), 1)
  23. self.menu.unlink()
  24. res = self.shortcut_obj.get_user_shortcuts()
  25. self.assertEqual(len(res), 0)