def test_has_role_user_with_role(self):
     role_names = TestUserRolesDatabase.add_roles_to_db(3)
     user = User('username', 'password')
     user.set_roles(role_names)
     db.session.commit()
     for role in role_names:
         self.assertTrue(user.has_role(role))
 def test_has_role_user_without_role(self):
     role_names = TestUserRolesDatabase.add_roles_to_db(3)
     user = User('username', 'password')
     user.set_roles(role_names)
     self.assertFalse(user.has_role('invalid'))
 def test_has_role_user_with_no_roles(self):
     user = User('username', 'password')
     self.assertFalse(user.has_role('role3'))