

@patch('st2actions.runners.ssh.parallel_ssh.ParallelSSHClient', Mock)
@patch.object(ParallelSSHClient, 'run', MagicMock(return_value={
    
}))
@patch.object(ParallelSSHClient, 'connect', MagicMock(return_value={
    
}))
def test_top_level_error_is_correctly_reported(self):
    paramiko_runner = ParamikoRemoteScriptRunner('runner_1')
    paramiko_runner.runner_parameters = {
        'username': 'test_user',
        'hosts': '127.0.0.1',
    }
    paramiko_runner.action = ACTION_1
    paramiko_runner.liveaction_id = 'foo'
    paramiko_runner.entry_point = 'foo'
    paramiko_runner.context = {
        
    }
    paramiko_runner._cwd = '/tmp'
    paramiko_runner._copy_artifacts = Mock(side_effect=Exception('fail!'))
    (status, result, _) = paramiko_runner.run(action_parameters={
        
    })
    self.assertEqual(status, LIVEACTION_STATUS_FAILED)
    self.assertEqual(result['failed'], True)
    self.assertEqual(result['succeeded'], False)
    self.assertTrue(('Failed copying content to remote boxes' in result['error']))

dataset/ETHPy150Open StackStorm/st2/st2actions/tests/unit/test_paramiko_remote_script_runner.py ParamikoScriptRunnerTestCase.test_top_level_error_is_correctly_reported/original