#NEWLINE# @ mock . patch ( 'nova.objects.Flavor.add_access' ) #NEWLINE# def test_add_tenant_access_with_flavor_not_found( self , mock_add ) : #NEWLINE# #INDENT# body = { #NEWLINE# #INDENT# 'addTenantAccess' : { #NEWLINE# #INDENT# 'tenant' : 'proj2' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# req = fakes . HTTPRequest . blank ( ( self . _prefix + '/flavors/2/action' ) , use_admin_context = True ) #NEWLINE# add_access = self . _get_add_access ( ) #NEWLINE# add_access ( req , '1000' , body = body ) #NEWLINE# mock_add . assert_called_once_with ( 'proj2' )