From 57d2becb8fdf560d0f2fb7f55ac2e5a3ddb2e933 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Sat, 22 Jun 2024 08:20:29 -0700 Subject: [PATCH] Add basic unit test for prepend_root_dir method --- tests/pytests/unit/test_config.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/pytests/unit/test_config.py b/tests/pytests/unit/test_config.py index 7437c8214ed..9ffc41dc6c4 100644 --- a/tests/pytests/unit/test_config.py +++ b/tests/pytests/unit/test_config.py @@ -5,6 +5,8 @@ tests.pytests.unit.test_config Unit tests for salt's config modulet """ +import sys + import salt.config @@ -21,3 +23,13 @@ def test_call_id_function(tmp_path): } ret = salt.config.call_id_function(opts) assert ret == "meh" + + +def test_prepend_root_dir(tmp_path): + root = tmp_path / "root" + opts = { + "root_dir": root, + "foo": "c:\\var\\foo" if sys.platform == "win32" else "/var/foo", + } + salt.config.prepend_root_dir(opts, ["foo"]) + assert opts["foo"] == str(root / "var" / "foo")