#NEWLINE# @ mock . patch ( 'nova.objects.Flavor._flavor_get_by_flavor_id_from_db' , side_effect = exception . FlavorNotFound ( flavor_id = 'foo' ) ) #NEWLINE# def test_remove_tenant_access_with_bad_access( self , mock_api_get ) : #NEWLINE# #INDENT# def stub_remove_flavor_access( context , flavorid , projectid ) : #NEWLINE# #INDENT# raise exception . FlavorAccessNotFound ( flavor_id = flavorid , project_id = projectid ) #NEWLINE# #UNINDENT# self . stub_out ( 'nova.db.flavor_access_remove' , stub_remove_flavor_access ) #NEWLINE# body = { #NEWLINE# #INDENT# 'removeTenantAccess' : { #NEWLINE# #INDENT# 'tenant' : 'proj2' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# remove_access = self . _get_remove_access ( ) #NEWLINE# self . assertRaises ( exc . HTTPNotFound , remove_access , self . req , '3' , body = self )