#NEWLINE# @ mock . patch . object ( vmops . objects . AggregateList , 'get_by_host' ) #NEWLINE# def test_get_host_uuid_from_aggregate_bad_aggr( self , mock_get_by_host ) : #NEWLINE# #INDENT# context = 'ctx' #NEWLINE# hostname = 'other_host' #NEWLINE# fake_aggregate_obj = objects . Aggregate ( hosts = [ 'fake' ] , metadata = { #NEWLINE# #INDENT# 'this' : 'that' , #NEWLINE# #UNINDENT# } ) #NEWLINE# fake_aggr_list = objects . AggregateList ( objects = [ fake_aggregate_obj ] ) #NEWLINE# mock_get_by_host . return_value = fake_aggr_list #NEWLINE# self . assertRaises ( exception . MigrationPreCheckError , self . vmops . _get_host_uuid_from_aggregate , context , hostname )