def test_client_read_timeout(self): client = SSHClient(self.host, port=self.port, pkey=self.user_key, num_retries=1) host_out = client.run_command('sleep 2; echo me', timeout=0.2) self.assertRaises(Timeout, list, host_out.stdout)
def test_agent_fwd(self): client = SSHClient(self.host, port=self.port, pkey=self.user_key, num_retries=1, allow_agent=True, forward_ssh_agent=True) out = client.run_command(self.cmd) client.wait_finished(out)
def scope_killer(): for _ in range(5): client = SSHClient(self.host, port=self.port, pkey=self.user_key, num_retries=1, allow_agent=False) host_out = client.run_command(self.cmd) output = list(host_out.stdout) self.assertListEqual(output, [self.resp]) client.disconnect()
def test_tunnel_server_same_port(self): remote_host = '127.0.0.7' remote_server = OpenSSHServer(listen_ip=remote_host, port=self.proxy_port) remote_server.start_server() try: client = SSHClient( remote_host, port=self.proxy_port, pkey=self.user_key, num_retries=1, proxy_host=self.proxy_host, ) output = client.run_command(self.cmd) _stdout = list(output.stdout) self.assertListEqual(_stdout, [self.resp]) self.assertEqual(remote_host, client.host) self.assertEqual(self.proxy_port, client.port) finally: remote_server.stop()