@@ -433,9 +433,8 @@ def test_run_shell_command_masked(self, fake_ssh_client, fake_click):
433
433
@patch ('pyinfra.api.connectors.ssh.SSHClient' )
434
434
def test_run_shell_command_success_exit_code (self , fake_ssh_client ):
435
435
fake_ssh = MagicMock ()
436
- fake_stdin = MagicMock ()
437
436
fake_stdout = MagicMock ()
438
- fake_ssh .exec_command .return_value = fake_stdin , fake_stdout , MagicMock ()
437
+ fake_ssh .exec_command .return_value = MagicMock () , fake_stdout , MagicMock ()
439
438
440
439
fake_ssh_client .return_value = fake_ssh
441
440
@@ -454,9 +453,8 @@ def test_run_shell_command_success_exit_code(self, fake_ssh_client):
454
453
@patch ('pyinfra.api.connectors.ssh.SSHClient' )
455
454
def test_run_shell_command_error (self , fake_ssh_client ):
456
455
fake_ssh = MagicMock ()
457
- fake_stdin = MagicMock ()
458
456
fake_stdout = MagicMock ()
459
- fake_ssh .exec_command .return_value = fake_stdin , fake_stdout , MagicMock ()
457
+ fake_ssh .exec_command .return_value = MagicMock () , fake_stdout , MagicMock ()
460
458
461
459
fake_ssh_client .return_value = fake_ssh
462
460
@@ -484,9 +482,8 @@ def test_run_shell_command_sudo_password_prompt(
484
482
fake_getpass ,
485
483
):
486
484
fake_ssh = MagicMock ()
487
- fake_stdin = MagicMock ()
488
485
fake_stdout = MagicMock ()
489
- fake_ssh .exec_command .return_value = fake_stdin , fake_stdout , MagicMock ()
486
+ fake_ssh .exec_command .return_value = MagicMock () , fake_stdout , MagicMock ()
490
487
491
488
fake_ssh_client .return_value = fake_ssh
492
489
fake_getpass .return_value = 'password'
@@ -499,7 +496,7 @@ def test_run_shell_command_sudo_password_prompt(
499
496
command = 'echo Šablony'
500
497
fake_stdout .channel .recv_exit_status .return_value = 0
501
498
502
- out = host .run_shell_command (command , use_sudo_password = True , print_output = True )
499
+ out = host .run_shell_command (command , sudo = True , use_sudo_password = True , print_output = True )
503
500
assert len (out ) == 3
504
501
505
502
status , stdout , stderr = out
@@ -511,7 +508,7 @@ def test_run_shell_command_sudo_password_prompt(
511
508
512
509
fake_ssh .exec_command .assert_called_with ((
513
510
'env SUDO_ASKPASS=pyinfra-sudo-askpass PYINFRA_SUDO_PASSWORD=password '
514
- "sh -c 'echo Šablony'"
511
+ "sudo -H -A -k sh -c 'echo Šablony'"
515
512
), get_pty = False )
516
513
517
514
# SSH file put/get tests
0 commit comments