Пример #1
0
 def test_has_role_user_with_role(self):
     role_ids = TestUserRolesDatabase.add_roles_to_db(3)
     user = User('username', 'password')
     user.set_roles(role_ids)
     db.session.commit()
     for role in role_ids:
         self.assertTrue(user.has_role(role))
Пример #2
0
 def test_has_role_user_without_role(self):
     role_ids = TestUserRolesDatabase.add_roles_to_db(3)
     user = User('username', 'password')
     user.set_roles(role_ids)
     self.assertFalse(user.has_role('invalid'))
Пример #3
0
 def test_has_role_user_with_no_roles(self):
     user = User('username', 'password')
     self.assertFalse(user.has_role(100))