示例#1
0
    def test_str_true(self):
        exemplar = """{
    "admin_or_owner": ""
}"""
        rules = policy.Rules(dict(admin_or_owner=policy.TrueCheck(), ))

        self.assertEqual(str(rules), exemplar)
示例#2
0
 def test_enforcer_with_default_rule(self):
     rules_json = """{
                     "deny_stack_user": "******",
                     "cloudwatch:PutMetricData": ""
                     }"""
     rules = policy.Rules.load_json(rules_json)
     default_rule = policy.TrueCheck()
     enforcer = policy.Enforcer(default_rule=default_rule)
     enforcer.set_rules(rules)
     action = "cloudwatch:PutMetricData"
     creds = {'roles': ''}
     self.assertEqual(enforcer.enforce(action, {}, creds), True)
示例#3
0
    def test_call(self):
        check = policy.TrueCheck()

        self.assertEqual(check('target', 'creds', None), True)
示例#4
0
    def test_str(self):
        check = policy.TrueCheck()

        self.assertEqual(str(check), '@')