Exemple #1
0
    def test_role_predicates(self):
        """Test predicate functions that identify user roles."""
        user = User()
        self.assertFalse(user.isAdmin())
        self.assertFalse(user.isPublisher())

        user.role = USER.PUBLISHER
        self.assertTrue(user.isPublisher())
        self.assertFalse(user.isAdmin())

        user.role = USER.ADMIN
        self.assertTrue(user.isPublisher())
        self.assertTrue(user.isAdmin())