diff --git a/invenio_rdm_records/services/pids/providers/external.py b/invenio_rdm_records/services/pids/providers/external.py index 0ef7dbf37..dedd11c2e 100644 --- a/invenio_rdm_records/services/pids/providers/external.py +++ b/invenio_rdm_records/services/pids/providers/external.py @@ -41,9 +41,9 @@ def __call__(self, record, identifier, provider, errors): for p in self.prefixes: if identifier.startswith(p): errors.append( - _("The prefix '{prefix}' is managed by {sitename}. Please supply an external DOI or select 'No' to have a DOI generated for you.").format( - prefix=p, sitename=current_app.config["THEME_SITENAME"] - ) + _( + "The prefix '{prefix}' is managed by {sitename}. Please supply an external DOI or select 'No' to have a DOI generated for you." + ).format(prefix=p, sitename=current_app.config["THEME_SITENAME"]) ) # Bail early return diff --git a/tests/conftest.py b/tests/conftest.py index 68bce23f8..babac43f2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -179,6 +179,8 @@ def app_config(app_config, mock_datacite_client): for config_key in supported_configurations: app_config[config_key] = getattr(config, config_key, None) + app_config["THEME_SITENAME"] = "Invenio" + app_config["RECORDS_REFRESOLVER_CLS"] = ( "invenio_records.resolver.InvenioRefResolver" ) diff --git a/tests/resources/test_resources_pids.py b/tests/resources/test_resources_pids.py index 8da039a71..9406928a5 100644 --- a/tests/resources/test_resources_pids.py +++ b/tests/resources/test_resources_pids.py @@ -128,7 +128,9 @@ def test_external_doi_blocked_prefix( assert draft.json["errors"] == [ { "field": "pids.doi", - "messages": ["The prefix '10.1234' is administrated locally."], + "messages": [ + "The prefix '10.1234' is managed by Invenio. Please supply an external DOI or select 'No' to have a DOI generated for you." + ], } ] diff --git a/tests/services/pids/test_pids_service.py b/tests/services/pids/test_pids_service.py index 035f871d9..d6a0d7951 100644 --- a/tests/services/pids/test_pids_service.py +++ b/tests/services/pids/test_pids_service.py @@ -258,7 +258,7 @@ def test_pids_duplicates(running_app, search_clear, minimal_record): "field": "pids.doi", "messages": [ f"doi:{doi} already exists.", - "The prefix '10.1234' is administrated locally.", + "The prefix '10.1234' is managed by Invenio. Please supply an external DOI or select 'No' to have a DOI generated for you.", ], } assert error_msg in duplicated_draft.errors @@ -271,7 +271,7 @@ def test_pids_duplicates(running_app, search_clear, minimal_record): "field": "pids.doi", "messages": [ f"doi:{doi} already exists.", - "The prefix '10.1234' is administrated locally.", + "The prefix '10.1234' is managed by Invenio. Please supply an external DOI or select 'No' to have a DOI generated for you.", ], } assert error_msg in duplicated_draft.errors