#NEWLINE# @ mock . patch . object ( api_utils , 'get_rpc_node' ) #NEWLINE# def test_get_all_by_node_name_ok( self , mock_get_rpc_node ) : #NEWLINE# #INDENT# mock_get_rpc_node . return_value = self . node #NEWLINE# for i in range ( 5 ) : #NEWLINE# #INDENT# if ( data < 3 ) : #NEWLINE# #INDENT# node_id = self . node . id #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# node_id = ( 100000 + i ) #NEWLINE# #UNINDENT# obj_utils . create_test_port ( self . context , node_id = node_id , uuid = uuidutils . generate_uuid ( ) , address = ( '52:54:00:cf:2d:3%s' % i ) ) #NEWLINE# #UNINDENT# data = self . get_json ( ( '/ports?node=%s' % 'test-node' ) , headers = { #NEWLINE# #INDENT# api_base . Version . string : '1.5' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( 3 , len ( data [ 'ports' ] ) )