#NEWLINE# @ mock . patch . object ( processutils , 'ssh_execute' , autospec = True ) #NEWLINE# def test__get_hosts_name_for_node_match( self , exec_ssh_mock ) : #NEWLINE# #INDENT# info = ssh . _parse_driver_info ( self . node ) #NEWLINE# info [ 'macs' ] = [ '11:11:11:11:11:11' , '52:54:00:cf:2d:31' ] #NEWLINE# ssh_cmd = ( '%s %s' % ( info [ 'cmd_set' ] [ 'base_cmd' ] , info [ 'cmd_set' ] [ 'list_all' ] ) ) #NEWLINE# cmd_to_exec = ( '%s %s' % ( info [ 'cmd_set' ] [ 'base_cmd' ] , info [ 'cmd_set' ] [ 'get_node_macs' ] ) ) #NEWLINE# cmd_to_exec = cmd_to_exec . replace ( '{_NodeName_}' , 'NodeName' ) #NEWLINE# exec_ssh_mock . side_effect = iter ( [ ( 'NodeName' , '' ) , ( '52:54:00:cf:2d:31' , '' ) ] ) #NEWLINE# expected = [ mock . call ( self . sshclient , ssh_cmd ) , mock . call ( self . sshclient , cmd_to_exec ) ] #NEWLINE# found_name = ssh . _get_hosts_name_for_node ( self . sshclient , info ) #NEWLINE# self . assertEqual ( 'NodeName' , found_name ) #NEWLINE# self . assertEqual ( expected , exec_ssh_mock . call_args_list )