Skip to content

Commit

Permalink
formatting and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
carlinmack authored and lnielsen committed Mar 20, 2024
1 parent 3349c51 commit 99f4430
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions invenio_rdm_records/services/pids/providers/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
4 changes: 3 additions & 1 deletion tests/resources/test_resources_pids.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
],
}
]

Expand Down
4 changes: 2 additions & 2 deletions tests/services/pids/test_pids_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 99f4430

Please sign in to comment.