Example #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)
Example #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)
Example #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)
Example #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)
Example #5
0
    def test_generic_boolean(self):
        result = policy._check_generic(None, "is_admin", "True", {},
                                       dict(is_admin=True))

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

        self.assertEqual(result, True)