Fixes for the handle_ssh return values now being lists of tuples

This commit is contained in:
MKLeb 2023-06-22 11:49:45 -04:00 committed by Gareth J. Greenaway
parent 79b5eeec96
commit 2f5c44a45e
2 changed files with 13 additions and 12 deletions

View file

@ -30,13 +30,16 @@ def test_password_failure(temp_salt_master, tmp_path):
opts["arg"] = []
roster = str(tmp_path / "roster")
handle_ssh_ret = [
{
"localhost": {
"retcode": 255,
"stderr": "Permission denied (publickey).\r\n",
"stdout": "",
}
},
(
{
"localhost": {
"retcode": 255,
"stderr": "Permission denied (publickey).\r\n",
"stdout": "",
}
},
1,
)
]
expected = {"localhost": "Permission denied (publickey)"}
display_output = MagicMock()
@ -50,4 +53,4 @@ def test_password_failure(temp_salt_master, tmp_path):
with pytest.raises(SystemExit):
client.run()
display_output.assert_called_once_with(expected, "nested", opts)
assert ret is handle_ssh_ret[0]
assert ret is handle_ssh_ret[0][0]

View file

@ -26,9 +26,7 @@ def test_not_missing_fun_calling_wfuncs(temp_salt_master, tmp_path):
opts["tgt"] = "localhost"
opts["arg"] = []
roster = str(tmp_path / "roster")
handle_ssh_ret = [
{"localhost": {}},
]
handle_ssh_ret = [({"localhost": {}}, 0)]
expected = {"localhost": {}}
display_output = MagicMock()
@ -44,7 +42,7 @@ def test_not_missing_fun_calling_wfuncs(temp_salt_master, tmp_path):
assert "fun" in ret["localhost"]
client.run()
display_output.assert_called_once_with(expected, "nested", opts)
assert ret is handle_ssh_ret[0]
assert ret is handle_ssh_ret[0][0]
assert len(client.event.fire_event.call_args_list) == 2
assert "fun" in client.event.fire_event.call_args_list[0][0][0]
assert "fun" in client.event.fire_event.call_args_list[1][0][0]