Skip to content

Commit

Permalink
tests: test account settings menu is not registered
Browse files Browse the repository at this point in the history
* Test that `ACCOUNTS_REGISTER_BLUEPRINT` is not registering the
  account settings menu
  • Loading branch information
zzacharo committed Dec 21, 2023
1 parent f86d842 commit 84639b8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_invenio_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
import requests
from flask import Flask
from flask_mail import Mail
from flask_menu import current_menu
from flask_security import url_for_security
from invenio_db import InvenioDB, db
from invenio_i18n import Babel

from invenio_accounts import InvenioAccounts, InvenioAccountsREST, testutils
from invenio_accounts.models import Role, User
from invenio_accounts.views.settings import blueprint


def test_version():
Expand Down Expand Up @@ -106,6 +108,21 @@ def test_init_rest():
assert "security_email_templates" in app.blueprints.keys()


def test_accounts_settings_blueprint(base_app):
"""Test settings blueprint when ACCOUNTS_REGISTER_BLUEPRINT is False."""
app = base_app
app.config["ACCOUNTS_REGISTER_BLUEPRINT"] = False
InvenioAccounts(app)
# register settings blueprint
app.register_blueprint(blueprint)

with app.app_context():
with app.test_client() as client:
client.get("/account/settings")
menu = current_menu.submenu("settings.change_password", auto_create=False)
assert not menu


@pytest.mark.skip(reason="Mergepoint is on invenio-access.")
def test_alembic(app):
"""Test alembic recipes."""
Expand Down

0 comments on commit 84639b8

Please sign in to comment.