Пример #1
0
def test_transitive():
    addons_set = mock_addons_set({
        "a": {
            "depends": ["b"]
        },
        "b": {
            "depends": ["c"]
        },
        "c": {
            "development_status": "Alpha"
        },
    })
    addons_selection = mock_addons_selection("a")
    errors = check_dev_status_command(
        addons_selection,
        addons_set,
        default_dev_status="Beta",
        transitive=False,
        odoo_series=OdooSeries.v13_0,
    )
    assert errors == []
    errors = check_dev_status_command(
        addons_selection,
        addons_set,
        default_dev_status="Beta",
        transitive=True,
        odoo_series=OdooSeries.v13_0,
    )
    assert errors == ["b (Beta) depends on c (Alpha)"]
Пример #2
0
def test_double():
    addons_set = mock_addons_set({
        "a": {
            "depends": ["b"],
            "development_status": "Stable"
        },
        "b": {
            "depends": ["c"],
            "development_status": "Beta"
        },
        "c": {
            "depends": [],
            "development_status": "Alpha"
        },
    })
    addons_selection = mock_addons_selection("a,b")
    errors = check_dev_status_command(
        sorted(addons_selection),
        addons_set,
        default_dev_status="Beta",
        transitive=True,
        odoo_series=OdooSeries.v13_0,
    )
    assert sorted(errors) == [
        "a (Stable) depends on b (Beta)",
        "b (Beta) depends on c (Alpha)",
    ]
Пример #3
0
def test_missing_selection():
    addons_set = mock_addons_set({})
    addons_selection = mock_addons_selection("a")
    errors = check_dev_status_command(
        addons_selection,
        addons_set,
        default_dev_status="Beta",
        transitive=False,
        odoo_series=OdooSeries.v13_0,
    )
    assert errors == ["a not found"]
Пример #4
0
def test_missing_dev_status():
    addons_set = mock_addons_set({
        "a": {},
    })
    addons_selection = mock_addons_selection("a")
    errors = check_dev_status_command(
        addons_selection,
        addons_set,
        default_dev_status=None,
        transitive=False,
        odoo_series=OdooSeries.v12_0,
    )
    assert errors == ["a has missing development_status"]
Пример #5
0
def test_ok():
    addons_set = mock_addons_set({
        "a": {
            "depends": ["b"]
        },
        "b": {},
    })
    addons_selection = mock_addons_selection("a")
    errors = check_dev_status_command(
        addons_selection,
        addons_set,
        default_dev_status="Beta",
        transitive=False,
        odoo_series=OdooSeries.v13_0,
    )
    assert errors == []
Пример #6
0
def test_missing_dev_status_depends():
    addons_set = mock_addons_set({
        "a": {
            "depends": ["b"],
            "development_status": "Stable"
        },
        "b": {},
    })
    addons_selection = mock_addons_selection("a")
    errors = check_dev_status_command(
        addons_selection,
        addons_set,
        default_dev_status=None,
        transitive=False,
        odoo_series=OdooSeries.v14_0,
    )
    assert errors == ["b has missing development_status"]
Пример #7
0
def test_core_addon():
    addons_set = mock_addons_set({
        "a": {
            "depends": ["base"],
            "development_status": "Stable"
        },
        "base": {},
    })
    addons_selection = mock_addons_selection("a")
    errors = check_dev_status_command(
        addons_selection,
        addons_set,
        default_dev_status="Beta",
        transitive=True,
        odoo_series=OdooSeries.v13_0,
    )
    assert errors == []
Пример #8
0
def test_invalid_dev_status():
    addons_set = mock_addons_set({
        "a": {
            "development_status": "bad"
        },
        "b": {
            "development_status": CORE_DEV_STATUS
        },
    })
    addons_selection = mock_addons_selection("a,b")
    errors = check_dev_status_command(
        addons_selection,
        addons_set,
        default_dev_status=None,
        transitive=False,
        odoo_series=OdooSeries.v13_0,
    )
    assert sorted(errors) == [
        "a has invalid development_status 'bad'",
        "b has invalid development_status 'core'",
    ]