#NEWLINE# @ patch ( 'paramiko.Channel.exec_command' ) #NEWLINE# @ patch ( 'paramiko.Transport.__init__' ) #NEWLINE# @ patch ( 'paramiko.Transport.open_channel' ) #NEWLINE# def test_handle_connection_exceptions( self , mock_open , mock_init , mock_channel ) : #NEWLINE# #INDENT# session = ncclient . transport . SSHSession ( self . obj ) #NEWLINE# session . _channel_id = 100 #NEWLINE# mock_init . return_value = None #NEWLINE# session . _transport = paramiko . Transport ( ) #NEWLINE# channel = paramiko . Channel ( 100 ) #NEWLINE# mock_open . return_value = channel #NEWLINE# self . obj . handle_connection_exceptions ( session ) #NEWLINE# self . assertEqual ( channel . _name , 'netconf-command-100' ) #NEWLINE# self . assertEqual ( mock_channel . call_args_list [ 0 ] [ 0 ] [ 0 ] , 'xml-mode netconf need-trailer' )