Esempio n. 1
0
 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)
Esempio n. 2
0
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()
Esempio n. 3
0
    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)]))
Esempio n. 4
0
 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)
Esempio n. 5
0
def registry():
    return actpy.registry(common.get_db_name())