def test_str_true(self): exemplar = """{ "admin_or_owner": "" }""" rules = policy.Rules(dict(admin_or_owner=policy.TrueCheck(), )) self.assertEqual(str(rules), exemplar)
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)
def test_call(self): check = policy.TrueCheck() self.assertEqual(check('target', 'creds', None), True)
def test_str(self): check = policy.TrueCheck() self.assertEqual(str(check), '@')