1 # -*- coding: utf-8 -*-
6 from openerp.tools.misc import mute_logger
10 ADMIN_USER_ID = common.ADMIN_USER_ID
13 return openerp.modules.registry.RegistryManager.get(DB).db.cursor()
16 class test_cr_execute(unittest2.TestCase):
17 """ Try cr.execute with wrong parameters """
19 @mute_logger('openerp.sql_db')
20 def test_execute_bad_params(self):
22 Try to use iterable but non-list or int params in query parameters.
25 with self.assertRaises(ValueError):
26 cr.execute("SELECT id FROM res_users WHERE login=%s", 'admin')
27 with self.assertRaises(ValueError):
28 cr.execute("SELECT id FROM res_users WHERE id=%s", 1)
29 with self.assertRaises(ValueError):
30 cr.execute("SELECT id FROM res_users WHERE id=%s", '1')
32 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: