def test_manual_auth(self): client = SSHClient(self.host, port=self.port, pkey=self.user_key, num_retries=1) client.session.disconnect() del client.session del client.sock client.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client._connect(self.host, self.port) client._init() # Identity auth client.pkey = None client.session.disconnect() del client.session del client.sock client.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client._connect(self.host, self.port) client.session = Session() client.session.handshake(client.sock) self.assertRaises(AuthenticationException, client.auth)
def test_manual_auth(self): client = SSHClient(self.host, port=self.port, pkey=self.user_key, num_retries=1, allow_agent=False) client.session.disconnect() del client.session del client.sock client._connect(self.host, self.port) client._init_session() # Identity auth client.pkey = None client.session.disconnect() del client.session del client.sock client._connect(self.host, self.port) client.session = Session() client.session.handshake(client.sock) self.assertRaises(AuthenticationException, client.auth)