Skip to content

Commit 99f4430

Browse files
carlinmacklnielsen
authored andcommitted
formatting and fix tests
1 parent 3349c51 commit 99f4430

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

invenio_rdm_records/services/pids/providers/external.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ def __call__(self, record, identifier, provider, errors):
4141
for p in self.prefixes:
4242
if identifier.startswith(p):
4343
errors.append(
44-
_("The prefix '{prefix}' is managed by {sitename}. Please supply an external DOI or select 'No' to have a DOI generated for you.").format(
45-
prefix=p, sitename=current_app.config["THEME_SITENAME"]
46-
)
44+
_(
45+
"The prefix '{prefix}' is managed by {sitename}. Please supply an external DOI or select 'No' to have a DOI generated for you."
46+
).format(prefix=p, sitename=current_app.config["THEME_SITENAME"])
4747
)
4848
# Bail early
4949
return

tests/conftest.py

+2
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ def app_config(app_config, mock_datacite_client):
179179
for config_key in supported_configurations:
180180
app_config[config_key] = getattr(config, config_key, None)
181181

182+
app_config["THEME_SITENAME"] = "Invenio"
183+
182184
app_config["RECORDS_REFRESOLVER_CLS"] = (
183185
"invenio_records.resolver.InvenioRefResolver"
184186
)

tests/resources/test_resources_pids.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ def test_external_doi_blocked_prefix(
128128
assert draft.json["errors"] == [
129129
{
130130
"field": "pids.doi",
131-
"messages": ["The prefix '10.1234' is administrated locally."],
131+
"messages": [
132+
"The prefix '10.1234' is managed by Invenio. Please supply an external DOI or select 'No' to have a DOI generated for you."
133+
],
132134
}
133135
]
134136

tests/services/pids/test_pids_service.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def test_pids_duplicates(running_app, search_clear, minimal_record):
258258
"field": "pids.doi",
259259
"messages": [
260260
f"doi:{doi} already exists.",
261-
"The prefix '10.1234' is administrated locally.",
261+
"The prefix '10.1234' is managed by Invenio. Please supply an external DOI or select 'No' to have a DOI generated for you.",
262262
],
263263
}
264264
assert error_msg in duplicated_draft.errors
@@ -271,7 +271,7 @@ def test_pids_duplicates(running_app, search_clear, minimal_record):
271271
"field": "pids.doi",
272272
"messages": [
273273
f"doi:{doi} already exists.",
274-
"The prefix '10.1234' is administrated locally.",
274+
"The prefix '10.1234' is managed by Invenio. Please supply an external DOI or select 'No' to have a DOI generated for you.",
275275
],
276276
}
277277
assert error_msg in duplicated_draft.errors

0 commit comments

Comments
 (0)