#NEWLINE# def test_remove_disassociated_floating_ip_from_instance( self ) : #NEWLINE# #INDENT# self . disassociated = False #NEWLINE# def fake_get_floating_ip_by_ip( ignore , context , ip ) : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# 'id' : 1 , #NEWLINE# 'address' : '10.10.10.10' , #NEWLINE# 'fixed_ip' : None , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# def fake_disassociate( ignore , context , floating_address ) : #NEWLINE# #INDENT# self . disassociated = True #NEWLINE# #UNINDENT# self . stubs . Set ( network . api . API , 'get_floating_ip_by_ip' , fake_get_floating_ip_by_ip ) #NEWLINE# self . stubs . Set ( network . api . API , 'disassociate_floating_ip' , fake_disassociate ) #NEWLINE# body = dict ( removeFloatingIp = dict ( address = '10.10.10.10' ) ) #NEWLINE# req = webob . Request . blank ( '/v1.1/123/servers/test_inst/action' ) #NEWLINE# req . method = 'POST' #NEWLINE# req . body = json . dumps ( body ) #NEWLINE# req . headers [ 'content-type' ] = 'application/json' #NEWLINE# resp = req . get_response ( fakes . wsgi_app ( ) ) #NEWLINE# self . assertEqual ( resp . status_int , 202 ) #NEWLINE# self . assertFalse ( self . disassociated )