'Basic execution.'

@patch.object(ParamikoSSHClient, '_consume_stdout', MagicMock(return_value=StringIO('')))
@patch.object(ParamikoSSHClient, '_consume_stderr', MagicMock(return_value=StringIO('')))
def test_basic_usage_absolute_path(self):

    mock = self.ssh_cli
    sd = '/root/random_script.sh'
    mock.connect()
    mock_cli = mock.client
    expected_conn = {'username': 'ubuntu', 'key_filename': '~/.ssh/ubuntu_ssh', 'allow_agent': False, 'hostname': 'dummy.host.org', 'look_for_keys': False, 'timeout': '600', 'port': 8822}
    mock_cli.connect.assert_called_once_with(**expected_conn)
    mock.put(sd)
    mock_cli.open_sftp().chdir.assert_called_with('root')
    mock_cli.open_sftp().file.assert_called_once_with('random_script.sh', mode='w')
    mock.run(sd)
    mock_cli.get_transport().open_session().exec_command.assert_called_once_with(sd)
    self.assertLogMsg('Executing    command    (cmd=/root/random_script.sh)')
    self.assertLogMsg('Command    finished')
    mock.close()
