def test_base_model_with_name(app, app_context): odoo_mock = MagicMock() Model = make_model_base(odoo_mock) class Partner(Model): _name = "res.partner" assert Partner._model_name() == "res.partner"
def test_base_model_no_name(app, app_context): odoo_mock = MagicMock() Model = make_model_base(odoo_mock) class Partner(Model): pass assert Partner._model_name() == "partner"
def test_base_model_no_domain(app, app_context): odoo_mock = MagicMock() Model = make_model_base(odoo_mock) class Partner(Model): _name = "res.partner" expected_domain = [["is_company", "=", True]] search_criteria = [["is_company", "=", True]] domain = Partner._construct_domain(search_criteria) assert domain == expected_domain
def test_make_model_base(): odoo_mock = MagicMock() Model = make_model_base(odoo_mock) assert issubclass(Model, schematics.models.Model) assert Model._odoo is odoo_mock