示例#1
0
    def test_generic_with_key_match(self):
        result = policy._check_generic(None, "tenant", "%(tenant_id)s",
                                       dict(tenant_id="spam"),
                                       dict(tenant="spam"))

        self.assertEqual(result, True)
示例#2
0
    def test_generic_no_key(self):
        result = policy._check_generic(None, "tenant", "%(tenant_id)s",
                                       dict(tenant_id="spam"),
                                       {})

        self.assertEqual(result, False)
示例#3
0
    def test_generic_with_key_match(self):
        result = policy._check_generic(None, "tenant", "%(tenant_id)s",
                                       dict(tenant_id="spam"),
                                       dict(tenant="spam"))

        self.assertEqual(result, True)
示例#4
0
    def test_generic_no_key(self):
        result = policy._check_generic(None, "tenant", "%(tenant_id)s",
                                       dict(tenant_id="spam"), {})

        self.assertEqual(result, False)
示例#5
0
    def test_generic_boolean(self):
        result = policy._check_generic(None, "is_admin", "True", {},
                                       dict(is_admin=True))

        self.assertEqual(result, True)
示例#6
0
    def test_generic_boolean(self):
        result = policy._check_generic(None, "is_admin", "True", {}, dict(is_admin=True))

        self.assertEqual(result, True)