diff --git a/setup.cfg b/setup.cfg index 9620930..e0274fb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -42,6 +42,7 @@ install_requires = [options.extras_require] tests = + flask_admin>=1.6.0 pytest-black-ng>=0.4.0 httpretty>=0.8.14 invenio-userprofiles>=3.0.0 diff --git a/tests/conftest.py b/tests/conftest.py index 097951a..896adce 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -24,7 +24,8 @@ from invenio_db import InvenioDB, db from invenio_i18n import Babel, InvenioI18N from invenio_userprofiles import InvenioUserProfiles -from invenio_userprofiles.views import blueprint_ui_init +from invenio_userprofiles.ext import finalize_app as userprofiles_finalize_app +from invenio_userprofiles.views import create_blueprint from sqlalchemy_utils.functions import create_database, database_exists, drop_database from invenio_oauthclient import InvenioOAuthClient, InvenioOAuthClientREST @@ -142,6 +143,7 @@ def base_app(request): APP_THEME=["semantic-ui"], THEME_ICONS={"semantic-ui": dict(link="linkify icon")}, OAUTHCLIENT_SETTINGS_TEMPLATE="invenio_oauthclient/settings/base.html", + USERPROFILES_EXTEND_SECURITY_FORMS=False, ) FlaskMenu(base_app) Babel(base_app) @@ -182,6 +184,10 @@ def _init_app(app_): InvenioOAuthClient(app_) app_.register_blueprint(blueprint_client) app_.register_blueprint(blueprint_settings) + + with app_.app_context(): + userprofiles_finalize_app(app_) + return app_ @@ -228,7 +234,10 @@ def app_rest_with_userprofiles(app_rest): def _init_userprofiles(app_): """Init userprofiles module.""" InvenioUserProfiles(app_) - app_.register_blueprint(blueprint_ui_init) + app_.register_blueprint(create_blueprint(app_)) + + with app_.app_context(): + userprofiles_finalize_app(app_) return app_ diff --git a/tests/test_handlers_rest.py b/tests/test_handlers_rest.py index 75c6174..0e221c2 100644 --- a/tests/test_handlers_rest.py +++ b/tests/test_handlers_rest.py @@ -2,14 +2,13 @@ # # This file is part of Invenio. # Copyright (C) 2016-2018 CERN. +# Copyright (C) 2024 Graz University of Technology. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Test handlers.""" -from turtle import pd - import pytest from flask import session, url_for from flask_login import current_user