@@ -116,7 +116,7 @@ def exec_result():
116116def test_001_execute_async_sudo (ssh , ssh_transport_channel ):
117117 ssh .sudo_mode = True
118118
119- ssh .execute_async (command )
119+ ssh ._execute_async (command )
120120 ssh_transport_channel .assert_has_calls (
121121 (
122122 mock .call .makefile_stderr ("rb" ),
@@ -129,11 +129,11 @@ def test_002_execute_async_with_sudo_enforce(ssh, ssh_transport_channel):
129129 assert ssh .sudo_mode is False
130130
131131 with ssh .sudo (enforce = True ):
132- ssh .execute_async (command )
132+ ssh ._execute_async (command )
133133 ssh_transport_channel .assert_has_calls (
134134 (
135135 mock .call .makefile_stderr ("rb" ),
136- mock .call .exec_command (f'sudo -S bash -c \' eval "$(base64 -d <(echo " { encoded_cmd } "))" \' ' ),
136+ mock .call .exec_command (f'sudo -S bash -c \" eval { shlex . quote ( cmd_execute ) } \" ' ),
137137 )
138138 )
139139
@@ -142,15 +142,15 @@ def test_003_execute_async_with_no_sudo_enforce(ssh, ssh_transport_channel):
142142 ssh .sudo_mode = True
143143
144144 with ssh .sudo (enforce = False ):
145- ssh .execute_async (command )
145+ ssh ._execute_async (command )
146146 ssh_transport_channel .assert_has_calls ((mock .call .makefile_stderr ("rb" ), mock .call .exec_command (f"{ command } \n " )))
147147
148148
149149def test_004_execute_async_with_sudo_none_enforce (ssh , ssh_transport_channel ):
150150 ssh .sudo_mode = False
151151
152152 with ssh .sudo ():
153- ssh .execute_async (command )
153+ ssh ._execute_async (command )
154154 ssh_transport_channel .assert_has_calls ((mock .call .makefile_stderr ("rb" ), mock .call .exec_command (f"{ command } \n " )))
155155
156156
@@ -159,11 +159,11 @@ def test_005_execute_async_sudo_password(ssh, ssh_transport_channel, mocker):
159159
160160 ssh .sudo_mode = True
161161
162- res = ssh .execute_async (command )
162+ res = ssh ._execute_async (command )
163163 ssh_transport_channel .assert_has_calls (
164164 (
165165 mock .call .makefile_stderr ("rb" ),
166- mock .call .exec_command (f'sudo -S bash -c \' eval "$(base64 -d <(echo " { encoded_cmd } "))" \' ' ),
166+ mock .call .exec_command (f'sudo -S bash -c \" eval { shlex . quote ( cmd_execute ) } \" ' ),
167167 )
168168 )
169169
@@ -221,15 +221,15 @@ def test_010_check_stdin_closed(paramiko_ssh_client, chan_makefile, auto_add_pol
221221 stdin_val = "this is a line"
222222
223223 ssh = exec_helpers .SSHClient (host = host , port = port , auth = exec_helpers .SSHAuth (username = username , password = password ))
224- ssh .execute_async (command = print_stdin , stdin = stdin_val )
224+ ssh ._execute_async (command = print_stdin , stdin = stdin_val )
225225
226226 log = get_logger (ssh .__class__ .__name__ ).getChild (f"{ host } :{ port } " )
227227 log .warning .assert_called_once_with ("STDIN Send failed: closed channel" )
228228
229229
230230def test_011_execute_async_chroot_cmd (ssh , ssh_transport_channel ):
231231 """Command-only chroot path."""
232- ssh .execute_async (command , chroot_path = '/' )
232+ ssh ._execute_async (command , chroot_path = '/' )
233233 ssh_transport_channel .assert_has_calls (
234234 (
235235 mock .call .makefile_stderr ("rb" ),
@@ -241,7 +241,7 @@ def test_011_execute_async_chroot_cmd(ssh, ssh_transport_channel):
241241def test_012_execute_async_chroot_context (ssh , ssh_transport_channel ):
242242 """Context-managed chroot path."""
243243 with ssh .chroot ('/' ):
244- ssh .execute_async (command )
244+ ssh ._execute_async (command )
245245 ssh_transport_channel .assert_has_calls (
246246 (
247247 mock .call .makefile_stderr ("rb" ),
@@ -255,7 +255,7 @@ def test_013_execute_async_no_chroot_context(ssh, ssh_transport_channel):
255255 ssh ._chroot_path = "/"
256256
257257 with ssh .chroot (None ):
258- ssh .execute_async (command )
258+ ssh ._execute_async (command )
259259 ssh_transport_channel .assert_has_calls (
260260 (
261261 mock .call .makefile_stderr ("rb" ),
0 commit comments