示例#1
0
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"
示例#2
0
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"
示例#3
0
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
示例#4
0
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