def test_get_files_warning(self, get_mock, warn_mock, makedirs_mock): remote_path = "/a/b" local_path = "/c/d" env.host = "remote_host" get_mock.side_effect = SystemExit collect.get_files(remote_path, local_path) warn_mock.assert_called_with("remote path " + remote_path + " not found on " + env.host)
def test_get_files(self, get_mock, makedirs_mock): remote_path = "/a/b" local_path = "/c/d" env.host = "myhost" path_with_host_name = path.join(local_path, env.host) collect.get_files(remote_path, local_path) makedirs_mock.assert_called_with(os.path.join(local_path, env.host)) get_mock.assert_called_with(remote_path, path_with_host_name, use_sudo=True)
def test_get_files(self, get_mock, path_exists_mock): remote_path = "/a/b" local_path = "/c/d" env.host = "myhost" path_with_host_name = path.join(local_path, env.host) path_exists_mock.return_value = True collect.get_files(remote_path, local_path) get_mock.assert_called_with(remote_path, path_with_host_name, use_sudo=True)