def test_xmlrpc_ir_model_search(self): """ Try a search on the object service. """ o = self.xmlrpc_object db_name = common.get_db_name() ids = o.execute(db_name, 1, 'admin', 'ir.model', 'search', []) self.assertIsInstance(ids, list) ids = o.execute(db_name, 1, 'admin', 'ir.model', 'search', [], {}) self.assertIsInstance(ids, list)
def environment(): """ Return an environment with a new cursor for the current database; the cursor is committed and closed after the context block. """ reg = registry(common.get_db_name()) with reg.cursor() as cr: yield api.Environment(cr, SUPERUSER_ID, {}) cr.commit()
def test_02_uninstall(self): """ Check a few things showing the module is uninstalled. """ with environment() as env: module = env['ir.module.module'].search([('name', '=', MODULE)]) assert len(module) == 1 module.button_uninstall() Registry.new(common.get_db_name(), update_module=True) with environment() as env: self.assertNotIn('test_uninstall.model', env.registry) self.assertFalse(env['ir.model.data'].search([('module', '=', MODULE)])) self.assertFalse(env['ir.model.fields'].search([('model', '=', MODEL)]))
def registry(): return izi.registry(common.get_db_name())
def test_01_xmlrpc_login(self): """ Try to login on the common service. """ db_name = common.get_db_name() uid = self.xmlrpc_common.login(db_name, 'admin', 'admin') self.assertEqual(uid, 1)