#NEWLINE# @ mock . patch ( 'nova.quota.QUOTAS.reserve' ) #NEWLINE# @ mock . patch ( 'nova.quota.QUOTAS.commit' ) #NEWLINE# @ mock . patch ( 'nova.network.api.API.delete' ) #NEWLINE# @ mock . patch ( 'nova.network.api.API.disassociate' ) #NEWLINE# def test_network_delete( self , disassociate_mock , delete_mock , commit_mock , reserve_mock ) : #NEWLINE# #INDENT# ctxt = self . req . environ [ 'nova.context' ] #NEWLINE# reserve_mock . return_value = 'rv' #NEWLINE# res = self . controller . delete ( self . req , 1 ) #NEWLINE# if isinstance ( self . controller , networks_v21 . TenantNetworkController ) : #NEWLINE# #INDENT# status_int = self . controller . delete . wsgi_code #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# status_int = res . status_int #NEWLINE# #UNINDENT# self . assertEqual ( 202 , status_int ) #NEWLINE# disassociate_mock . assert_called_once_with ( ctxt , 1 ) #NEWLINE# delete_mock . assert_called_once_with ( ctxt , 1 ) #NEWLINE# commit_mock . assert_called_once_with ( ctxt , 'rv' ) #NEWLINE# reserve_mock . assert_called_once_with ( ctxt , networks = ( - 1 ) )