Beispiel #1
0
 def test_templatized_authorization(self):
     target_mine = {'project_id': 'fake'}
     target_not_mine = {'project_id': 'another'}
     action = "test:my_file"
     policy.authorize(self.context, action, target_mine)
     self.assertRaises(exception.PolicyNotAuthorized, policy.authorize,
                       self.context, action, target_not_mine)
Beispiel #2
0
 def test_ignore_case_role_check(self):
     lowercase_action = "test:lowercase_admin"
     uppercase_action = "test:uppercase_admin"
     admin_context = context.RequestContext('admin',
                                            'fake',
                                            roles=['AdMiN'])
     policy.authorize(admin_context, lowercase_action, self.target)
     policy.authorize(admin_context, uppercase_action, self.target)
Beispiel #3
0
 def test_early_OR_authorization(self):
     action = "test:early_or_success"
     policy.authorize(self.context, action, self.target)
Beispiel #4
0
 def test_authorize_good_action(self):
     action = "test:allowed"
     result = policy.authorize(self.context, action, self.target)
     self.assertTrue(result)
Beispiel #5
0
 def test_authorize_bad_action_noraise(self):
     action = "test:denied"
     result = policy.authorize(self.context, action, self.target, False)
     self.assertFalse(result)