示例#1
0
    def test_only_in_role(self, role, target):
        role.add_users(self.user)
        cache = RoleCache(self.user)
        self.assertTrue(cache.has_role(*target))

        for other_role, other_target in self.ROLES:
            if other_role == role:
                continue

            self.assertFalse(cache.has_role(*other_target))
示例#2
0
 def test_empty_cache(self, role, target):
     cache = RoleCache(self.user)
     self.assertFalse(cache.has_role(*target))