#NEWLINE# def test_stop_policy_failed( self ) : #NEWLINE# #INDENT# rules = { #NEWLINE# #INDENT# self . stop_policy : 'project_id:non_fake' , #NEWLINE# #UNINDENT# } #NEWLINE# policy . set_rules ( oslo_policy . Rules . from_dict ( rules ) ) #NEWLINE# self . stub_out ( 'nova.db.instance_get_by_uuid' , fake_instance_get ) #NEWLINE# body = dict ( stop = '' ) #NEWLINE# exc = self . assertRaises ( exception . PolicyNotAuthorized , self . controller . _stop_server , self . req , 'test_inst' , exc ) #NEWLINE# self . assertIn ( self . stop_policy , exc . format_message ( ) )