-
Notifications
You must be signed in to change notification settings - Fork 113
fix(doi link): show appropriate DOI link in test(any) environment #2269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,7 +42,7 @@ install_requires = | |
| invenio-checks>=4.0.0,<5.0.0 | ||
| invenio-communities>=23.0.0,<24.0.0 | ||
| invenio-drafts-resources>=8.0.0,<9.0.0 | ||
| invenio-records-resources>=9.0.0,<10.0.0 | ||
| invenio-records-resources>=9.1.0,<10.0.0 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just wondering; this PR looks pretty self-contained, I couldn't find anything that obviously needs a dependency bump?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yeah this wasn't related to this PR directly but I bumped into it when running tests: this commit 179949e introduced import of DateFacet, but DateFacet are only available in invenio-records==9.1.0+, so that dependency had to be bumped. |
||
| invenio-github>=5.0.0,<6.0.0 | ||
| invenio-i18n>=3.0.0,<4.0.0 | ||
| invenio-jobs>=7.0.0,<8.0.0 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,20 @@ | |
| from invenio_rdm_records.resources.serializers.csl.schema import CSLJSONSchema | ||
|
|
||
|
|
||
| def test_string_citation_serializer(running_app, full_record_to_dict): | ||
| serializer = StringCitationSerializer( | ||
| url_args_retriever=("modern-language-association", "en-US") | ||
| ) | ||
|
|
||
| result = serializer.serialize_object(full_record_to_dict) | ||
|
|
||
| expected = ( | ||
| "Nielsen, L. H.and B. Tom. Inveniordm. v1.0, InvenioRDM, 2018–Sept. 2020, " | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that'd be an issue in citeproc, but is there a space missing between the the end of the first author and
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh good eye on that one. It's indeed the citeproc's MLA citation that is like that e.g., https://zenodo.org/records/18927380 (and select MLA) :/ Not much we can do for now. |
||
| "https://handle.test.datacite.org/10.1234/inveniordm.1234." | ||
| ) | ||
| assert expected == result | ||
|
|
||
|
|
||
| def test_csl_json_serializer(running_app, full_record_to_dict): | ||
| """Test JSON CLS Serializer.""" | ||
| # if the record is created this field will be present | ||
|
|
@@ -72,6 +86,7 @@ def test_citation_string_serializer_records_list( | |
| for _ in range(3): | ||
| draft = service.create(superuser_identity, minimal_record) | ||
| record = service.publish(superuser_identity, draft.id) | ||
|
|
||
| expected_record_data = get_citation_string( | ||
| CSLJSONSchema().dump(record), | ||
| record.id, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for my understanding: Effectively, the "protocol" for
get_citation_string()gets extended so that if an_extrasfield with a DOI link is present, then that will be used to replace the defaultdoi.orglink?In this code path (
serialize_object()) that will always be the case; external calls can use it if they want, or keep using it without (in which case the logic is backwards-compatible).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's right. I didn't want to add additional keyword arguments to
get_citation_stringas it would be getting christmas tree like and the doi link seemed like it really had to do with the serialized record. All the replacements and fetching of that data is very backwards compatible/cautious so doesn't alter anything unduly.