#NEWLINE# def test_floating_ip_target_get_by_instance( self ) : #NEWLINE# #INDENT# ports = self . api_ports . list ( ) #NEWLINE# candidates = [ p for p in ports if ( p [ 'device_id' ] == '1' ) ] #NEWLINE# search_opts = { #NEWLINE# #INDENT# 'device_id' : '1' , #NEWLINE# #UNINDENT# } #NEWLINE# self . qclient . list_ports ( ** search_opts ) . AndReturn ( { #NEWLINE# #INDENT# 'ports' : candidates , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# ret = api . network . floating_ip_target_get_by_instance ( self . request , '1' ) #NEWLINE# self . assertEqual ( ret , self . _get_target_id ( self [ 0 ] ) )