#NEWLINE# @ mock . patch ( 'nova.quota.QUOTAS.reserve' ) #NEWLINE# @ mock . patch ( 'nova.quota.QUOTAS.rollback' ) #NEWLINE# @ mock . patch ( 'nova.network.api.API.create' ) #NEWLINE# def _test_network_create_exception( self , ex , expex , create_mock , rollback_mock , reserve_mock ) : #NEWLINE# #INDENT# ctxt = self . req . environ [ 'nova.context' ] #NEWLINE# reserve_mock . return_value = 'rv' #NEWLINE# create_mock . side_effect = ex #NEWLINE# body = { #NEWLINE# #INDENT# 'network' : { #NEWLINE# #INDENT# 'cidr' : '10.20.105.0/24' , #NEWLINE# 'label' : 'new net 1' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertRaises ( expex , self . controller . create , self . req , body = rollback_mock ) #NEWLINE# reserve_mock . assert_called_once_with ( ctxt , networks = 1 )