def create_user_with_role(role_name): """Create user a role `role_name`""" user = create_user() role = next(role for role in roles.global_roles() if role["name"] == role_name) rest_service.UserRolesService().create_obj(person=user.__dict__, role=role) user.system_wide_role = role["name"] return user