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.

27 lines
971 B

8 years ago
  1. from openerp.tests.common import HttpCase, TransactionCase
  2. class TestWebShortcut(TransactionCase):
  3. def setUp(self, *args, **kwargs):
  4. super(TestWebShortcut, self).setUp(*args, **kwargs)
  5. self.shortcut_obj = self.env['web.shortcut']
  6. self.menu_obj = self.env['ir.ui.menu']
  7. self.menu = self.env.ref('base.menu_ir_property')
  8. self.user = self.env.ref('base.user_root')
  9. self.shortcut_obj.search([('user_id', '=', self.user.id)]).unlink()
  10. def test_web_shortcut(self):
  11. res = self.shortcut_obj.get_user_shortcuts()
  12. self.assertEqual(len(res), 0)
  13. self.shortcut_obj.create({
  14. 'name': 'Test',
  15. 'menu_id': self.menu.id,
  16. 'user_id': self.env.user.id
  17. })
  18. res = self.shortcut_obj.get_user_shortcuts()
  19. self.assertEqual(len(res), 1)
  20. self.menu.unlink()
  21. res = self.shortcut_obj.get_user_shortcuts()
  22. self.assertEqual(len(res), 0)