#NEWLINE# @ mock . patch ( 'nova.compute.api.AggregateAPI.create_aggregate' ) #NEWLINE# def test_create_with_none_availability_zone( self , mock_create_agg ) : #NEWLINE# #INDENT# mock_create_agg . return_value = objects . Aggregate ( self . context , name = 'test' , uuid = uuid . uuid4 ( ) , hosts = [ ] , metadata = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# body = { #NEWLINE# #INDENT# 'aggregate' : { #NEWLINE# #INDENT# 'name' : 'test' , #NEWLINE# 'availability_zone' : None , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# result = self . controller . create ( self . req , body = body ) #NEWLINE# mock_create_agg . assert_called_once_with ( self . context , 'test' , None ) #NEWLINE# self . assertEqual ( result [ 'aggregate' ] [ 'name' ] , 'test' )