Write some tests

This commit is contained in:
Twangboy 2023-05-01 17:35:34 -06:00 committed by Pedro Algarvio
parent 8f0f4f1d3b
commit 962f708c92

View file

@ -401,3 +401,26 @@ def test_dict_bool_none_types(option_value, expected):
"""
result = salt.config._validate_opts({"ssl": option_value})
assert result is expected
@pytest.mark.parametrize(
"option_value,expected",
[
([1, 2, 3], False), # list
((1, 2, 3), False), # tuple
({"key": "value"}, False), # dict
("str", False), # str
(True, True), # bool
(1, True), # int
(0.123, False), # float
(None, False), # None
],
)
def test_bool_int_types(option_value, expected):
"""
Some config settings have three types, dict, bool, and None which should
evaluate as True. All others should return False.
ssl is a dict, bool type config option
"""
result = salt.config._validate_opts({"state_queue": option_value})
assert result is expected