def test_run_command_password(self):
        vendor = ParamikoSSHVendor(
            allow_agent=False,
            look_for_keys=False,
        )
        vendor.run_command('127.0.0.1',
                           'test_run_command_password',
                           username=USER,
                           port=self.port,
                           password=PASSWORD)

        self.assertIn(b'test_run_command_password', self.commands)
    def test_run_command_with_privkey(self):
        key = paramiko.RSAKey.from_private_key(StringIO(CLIENT_KEY))

        vendor = ParamikoSSHVendor(
            allow_agent=False,
            look_for_keys=False,
        )
        vendor.run_command('127.0.0.1',
                           'test_run_command_with_privkey',
                           username=USER,
                           port=self.port,
                           pkey=key)

        self.assertIn(b'test_run_command_with_privkey', self.commands)
    def test_run_command_data_transfer(self):
        vendor = ParamikoSSHVendor(
            allow_agent=False,
            look_for_keys=False,
        )
        con = vendor.run_command('127.0.0.1',
                                 'test_run_command_data_transfer',
                                 username=USER,
                                 port=self.port,
                                 password=PASSWORD)

        self.assertIn(b'test_run_command_data_transfer', self.commands)

        channel = self.transport.accept(5)
        channel.send(b'stdout\n')
        channel.send_stderr(b'stderr\n')
        channel.close()

        # Fixme: it's return false
        # self.assertTrue(con.can_read())

        self.assertEqual(b'stdout\n', con.read(4096))