def test_plugins_connection_ssh__build_command_custom_exec(self): pc = PlayContext() pc.ssh_executable = 'mysshwrapper' pc.ssh_extra_args = '--customarg value' new_stdin = StringIO() conn = connection_loader.get('ssh', pc, new_stdin) cmd = conn._build_command('ssh', ['sshcommand', 'arg1', 'arg2']) self.assertEqual(cmd[0], b'mysshwrapper') self.assertIn(b'--customarg', cmd) self.assertIn(b'sshcommand', cmd) self.assertIn(b'arg1', cmd) self.assertIn(b'arg2', cmd)
def get_play_context(self): play_context = PlayContext(play=None, options=None, passwords=self._passwords) play_context.remote_addr = self.addr play_context.port = self.port play_context.remote_user = self.user play_context.ssh_executable = 'ssh' play_context.timeout = 10 play_context.connection = 'ssh' play_context.become = self.sudo play_context.become_method = 'sudo' play_context.become_user = '******' return play_context