#NEWLINE# def test_evacuate_policy_failed( self ) : #NEWLINE# #INDENT# rule_name = 'os_compute_api:os-evacuate' #NEWLINE# self . policy . set_rules ( { #NEWLINE# #INDENT# rule_name : 'project:non_fake' , #NEWLINE# #UNINDENT# } ) #NEWLINE# req = fakes . HTTPRequest . blank ( '' ) #NEWLINE# body = { #NEWLINE# #INDENT# 'evacuate' : { #NEWLINE# #INDENT# 'host' : 'my-host' , #NEWLINE# 'onSharedStorage' : 'False' , #NEWLINE# 'adminPass' : 'MyNewPass' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# exc = self . assertRaises ( exception . PolicyNotAuthorized , self . controller . _evacuate , req , fakes . FAKE_UUID , body = body ) #NEWLINE# self . assertEqual ( ( "Policy doesn't allow %s to be performed." % rule_name ) , exc . format_message ( ) )