Exemplo n.º 1
0
 def test_user_role(self):
     u = User(email='*****@*****.**', password='******')
     self.assertTrue(u.can(Permission.FOLLOW))
     self.assertTrue(u.can(Permission.COMMENT))
     self.assertTrue(u.can(Permission.WRITE))
     self.assertFalse(u.can(Permission.MODERATE))
     self.assertFalse(u.can(Permission.ADMIN))
Exemplo n.º 2
0
 def test_administrator_role(self):
     r = Role.query.filter_by(name='Administrator').first()
     u = User(email='*****@*****.**', password='******', role=r)
     self.assertTrue(u.can(Permission.FOLLOW))
     self.assertTrue(u.can(Permission.COMMENT))
     self.assertTrue(u.can(Permission.WRITE))
     self.assertTrue(u.can(Permission.MODERATE))
     self.assertTrue(u.can(Permission.ADMIN))