def create_fake_user(user_cls, email="unittest@me.com", userid=1, roles=None):
    """ Create fake user optionally with roles """
    user = user_cls()
    user.email = email
    user.id = userid
    user.password = "mypassword"
    user.active = True
    if roles:
        if isinstance(roles, list):
            user.roles = roles
        else:
            user.roles = [roles]
    return user