skip if no docker and fix failing test

This commit is contained in:
MKLeb 2022-02-24 14:06:29 -05:00 committed by Gareth J. Greenaway
parent f36f9b4002
commit cb056ac98b
2 changed files with 7 additions and 3 deletions

View file

@ -15,6 +15,7 @@ log = logging.getLogger(__name__)
pytestmark = [
pytest.mark.windows_whitelisted,
pytest.mark.skipif(not HAS_LIBS, reason="Need etcd libs to test etcd_util!"),
pytest.mark.skip_if_binaries_missing("docker", "dockerd", check_all=False),
]

View file

@ -90,9 +90,6 @@ def test_get():
assert client.get("salt") == "stack"
mock.assert_called_with("salt", recursive=False)
assert client.get("salt", recurse=True) == "stack"
mock.assert_called_with("salt", recursive=True)
# iter(list(Exception)) works correctly with both mock<1.1 and mock>=1.1
mock.side_effect = iter([etcd.EtcdKeyNotFound()])
assert client.get("not-found") is None
@ -108,6 +105,12 @@ def test_get():
with pytest.raises(Exception):
client.get("some-error")
# Get with recurse now delegates to client.tree
with patch.object(client, "tree", autospec=True) as tree_mock:
tree_mock.return_value = {"salt": "stack"}
assert client.get("salt", recurse=True) == {"salt": "stack"}
tree_mock.assert_called_with("salt")
def test_tree():
"""