Exemple #1
0
 def test_check_credentials_default(self):
     policy.reset()
     enforcer = policy._get_enforcer()
     scope = enforcer['with_default']
     user = utils.get_user()
     credentials = policy._user_to_credentials(user)
     target = {
         'project_id': user.project_id,
         'tenant_id': user.project_id,
         'user_id': user.id,
         'domain_id': user.user_domain_id,
         'user.domain_id': user.user_domain_id,
         'group.domain_id': user.user_domain_id,
         'project.domain_id': user.user_domain_id,
     }
     is_valid = policy._check_credentials(scope, 'action', target,
                                          credentials)
     self.assertFalse(is_valid)
 def test_policy_reset(self):
     policy._get_enforcer()
     self.assertEqual(2, len(policy._ENFORCER))
     policy.reset()
     self.assertIsNone(policy._ENFORCER)
 def test_policy_file_load(self):
     policy.reset()
     enforcer = policy._get_enforcer()
     self.assertEqual(2, len(enforcer))
     self.assertTrue('identity' in enforcer)
     self.assertTrue('compute' in enforcer)
Exemple #4
0
 def test_policy_file_load(self):
     policy_backend.reset()
     enforcer = policy_backend._get_enforcer()
     self.assertEqual(2, len(enforcer))
     self.assertIn('identity', enforcer)
     self.assertIn('compute', enforcer)