From 8a724997a73200d5d5769dc4da42a4e66894d288 Mon Sep 17 00:00:00 2001 From: Tyler Levy Conde Date: Tue, 16 Apr 2024 15:22:23 -0600 Subject: [PATCH] Remove extra tests added after rebasing --- tests/pytests/unit/client/ssh/test_shell.py | 27 --------------------- 1 file changed, 27 deletions(-) diff --git a/tests/pytests/unit/client/ssh/test_shell.py b/tests/pytests/unit/client/ssh/test_shell.py index 54106217fbc..4749fb3453b 100644 --- a/tests/pytests/unit/client/ssh/test_shell.py +++ b/tests/pytests/unit/client/ssh/test_shell.py @@ -1,5 +1,4 @@ import importlib -import logging import subprocess import types @@ -102,32 +101,6 @@ def test_ssh_shell_exec_cmd_returns_status_code_with_highest_bit_set_if_process_ assert retcode == 137 -def exec_cmd(cmd): - if cmd.startswith("mkdir -p"): - return "", "Not a directory", 1 - return "OK", "", 0 - - -def test_ssh_shell_send_makedirs_failure_returns_immediately(): - with patch("salt.client.ssh.shell.Shell.exec_cmd", side_effect=exec_cmd): - shl = shell.Shell({}, "localhost") - stdout, stderr, retcode = shl.send("/tmp/file", "/tmp/file", True) - assert retcode == 1 - assert "Not a directory" in stderr - - -def test_ssh_shell_send_makedirs_on_relative_filename_skips_exec(caplog): - with patch("salt.client.ssh.shell.Shell.exec_cmd", side_effect=exec_cmd) as cmd: - with patch("salt.client.ssh.shell.Shell._run_cmd", return_value=("", "", 0)): - shl = shell.Shell({}, "localhost") - with caplog.at_level(logging.WARNING): - stdout, stderr, retcode = shl.send("/tmp/file", "targetfile", True) - assert retcode == 0 - assert "Not a directory" not in stderr - assert call("mkdir -p ''") not in cmd.mock_calls - assert "Makedirs called on relative filename" in caplog.text - - @pytest.fixture() def mock_bin_paths(): """Automatically apply fixture to all tests that need it."""