예제 #1
0
    def test_call_false(self):
        check = policy_engine.IsAdminCheck('is_admin', 'False')

        self.assertFalse(
            check('target', dict(is_admin=True), policy_engine._ENFORCER))
        self.assertTrue(
            check('target', dict(is_admin=False), policy_engine._ENFORCER))
예제 #2
0
    def test_init_false(self):
        check = policy_engine.IsAdminCheck('is_admin', 'nottrue')

        self.assertEqual(check.kind, 'is_admin')
        self.assertEqual(check.match, 'False')
        self.assertFalse(check.expected)