#NEWLINE# @ mock . patch ( 'nova.objects.Flavor._flavor_get_by_flavor_id_from_db' , side_effect = exception . FlavorNotFound ( flavor_id = 'foo' ) ) #NEWLINE# def test_delete_tenant_access_with_no_tenant( self , mock_api_get ) : #NEWLINE# #INDENT# req = fakes . HTTPRequest . blank ( ( self . _prefix + '/flavors/2/action' ) , use_admin_context = True ) #NEWLINE# remove_access = self . _get_remove_access ( ) #NEWLINE# body = { #NEWLINE# #INDENT# 'removeTenantAccess' : { #NEWLINE# #INDENT# 'foo' : 'proj2' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertRaises ( self . validation_ex , mock_api_get , req , '2' , body = body ) #NEWLINE# body = { #NEWLINE# #INDENT# 'removeTenantAccess' : { #NEWLINE# #INDENT# 'tenant' : '' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertRaises ( self . validation_ex , remove_access , req , '2' , body = body )