Exemplo n.º 1
0
    def test_call_false(self):
        check = policy.IsAdminCheck('is_admin', 'False')

        self.assertFalse(
            check('target', dict(is_admin=True), policy.get_enforcer()))
        self.assertTrue(
            check('target', dict(is_admin=False), policy.get_enforcer()))
Exemplo n.º 2
0
    def test_call_false(self):
        check = policy.IsAdminCheck('is_admin', 'False')

        self.assertFalse(
            check('target', dict(is_admin=True), self.context.policy))
        self.assertTrue(
            check('target', dict(is_admin=False), self.context.policy))
Exemplo n.º 3
0
    def test_init_false(self):
        check = policy.IsAdminCheck('is_admin', 'nottrue')

        self.assertEqual(check.kind, 'is_admin')
        self.assertEqual(check.match, 'False')
        self.assertFalse(check.expected)
Exemplo n.º 4
0
    def test_init_true(self):
        check = policy.IsAdminCheck('is_admin', 'True')

        self.assertEqual(check.kind, 'is_admin')
        self.assertEqual(check.match, 'True')
        self.assertTrue(check.expected)