mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add unit tests to check path is expanded
This commit is contained in:
parent
a5599d6c89
commit
f597c14263
2 changed files with 25 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
import salt.config
|
||||
from tests.support.mock import MagicMock, patch
|
||||
|
||||
|
||||
def test_apply_no_cluster_id():
|
||||
|
@ -60,3 +61,14 @@ def test_apply_for_cluster():
|
|||
assert isinstance(opts["cluster_peers"], list)
|
||||
opts["cluster_peers"].sort()
|
||||
assert ["127.0.0.1", "127.0.0.3"] == opts["cluster_peers"]
|
||||
|
||||
|
||||
def test___cli_path_is_expanded():
|
||||
defaults = salt.config.DEFAULT_MASTER_OPTS.copy()
|
||||
overrides = {}
|
||||
with patch(
|
||||
"salt.utils.path.expand", MagicMock(return_value="/path/to/testcli")
|
||||
) as expand_mock:
|
||||
opts = salt.config.apply_master_config(overrides, defaults)
|
||||
assert expand_mock.called
|
||||
assert opts["__cli"] == "testcli"
|
||||
|
|
13
tests/pytests/unit/config/test_minion_config.py
Normal file
13
tests/pytests/unit/config/test_minion_config.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
import salt.config
|
||||
from tests.support.mock import MagicMock, patch
|
||||
|
||||
|
||||
def test___cli_path_is_expanded():
|
||||
defaults = salt.config.DEFAULT_MINION_OPTS.copy()
|
||||
overrides = {}
|
||||
with patch(
|
||||
"salt.utils.path.expand", MagicMock(return_value="/path/to/testcli")
|
||||
) as expand_mock:
|
||||
opts = salt.config.apply_minion_config(overrides, defaults)
|
||||
assert expand_mock.called
|
||||
assert opts["__cli"] == "testcli"
|
Loading…
Add table
Reference in a new issue