From 94f233cefa3eda27d8f4e126aebc0f8771e00ea7 Mon Sep 17 00:00:00 2001 From: Joseph Hall Date: Mon, 18 Sep 2023 12:46:09 -0600 Subject: [PATCH] Formula tests for vim and sudoers --- .../functional/formulas/test_sudoers.py | 26 +++++++++++++++++++ tests/pytests/functional/formulas/test_vim.py | 26 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 tests/pytests/functional/formulas/test_sudoers.py create mode 100644 tests/pytests/functional/formulas/test_vim.py diff --git a/tests/pytests/functional/formulas/test_sudoers.py b/tests/pytests/functional/formulas/test_sudoers.py new file mode 100644 index 00000000000..f338ebefebc --- /dev/null +++ b/tests/pytests/functional/formulas/test_sudoers.py @@ -0,0 +1,26 @@ +""" +Tests using sudoers formula +""" +import pytest + + +@pytest.fixture(scope="module") +def _formula(saltstack_formula): + with saltstack_formula(name="sudoers-formula", tag="0.25.0") as formula: + yield formula + + +@pytest.fixture(scope="module") +def modules(loaders, _formula): + loaders.opts["file_roots"]["base"].append( + str(_formula.state_tree_path / f"{_formula.name}-{_formula.tag}") + ) + return loaders.modules + + +@pytest.mark.skip_on_windows +@pytest.mark.destructive_test +def test_sudoers_formula(modules): + ret = modules.state.sls("sudoers") + for staterun in ret: + assert staterun.result diff --git a/tests/pytests/functional/formulas/test_vim.py b/tests/pytests/functional/formulas/test_vim.py new file mode 100644 index 00000000000..18a3fabc7be --- /dev/null +++ b/tests/pytests/functional/formulas/test_vim.py @@ -0,0 +1,26 @@ +""" +Tests using vim formula +""" +import pytest + + +@pytest.fixture(scope="module") +def _formula(saltstack_formula): + with saltstack_formula(name="vim-formula", tag="0.15.5") as formula: + yield formula + + +@pytest.fixture(scope="module") +def modules(loaders, _formula): + loaders.opts["file_roots"]["base"].append( + str(_formula.state_tree_path / f"{_formula.name}-{_formula.tag}") + ) + return loaders.modules + + +@pytest.mark.skip_on_windows +@pytest.mark.destructive_test +def test_vim_formula(modules): + ret = modules.state.sls("vim") + for staterun in ret: + assert staterun.result