Skip to content

Commit

Permalink
#2817: Adds test case journal DOI on crossref's XML serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
mauromsl committed Sep 13, 2022
1 parent 9e3a3b0 commit cef52df
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/identifiers/tests/test_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,34 @@ def test_issue_doi_deposited_correctly(self):
if not found:
raise AssertionError("No Issue DOI found on article deposit")

def test_journal_doi_deposited_correctly(self):
template = 'common/identifiers/crossref_doi_batch.xml'
issue = self.article_one.issue
journal_doi = "10.0001/journal"
save_setting('Identifiers', 'title_doi', issue.journal, journal_doi)
identifier = self.article_one.get_doi_object
clear_cache()

template_context = logic.create_crossref_doi_batch_context(
self.article_one.journal,
{identifier},
)
deposit = logic.render_to_string(template, template_context)

soup = BeautifulSoup(deposit, 'lxml')
# There should be one doi_batch
journal_soup = soup.find('journal_metadata')
found = False
if journal_soup:
doi_soup = journal_soup.find("doi_data")
if doi_soup:
self.assertEqual(doi_soup.find("doi").string, journal_doi)
self.assertEqual(
doi_soup.find("resource").string, issue.journal.site_url())
found = True
if not found:
raise AssertionError("No Issue DOI found on article deposit")

def test_issue_doi_auto_assigned(self):
issue = helpers.create_issue(self.journal_one, vol=99, number=99)
self.request.POST = {"assign_issue": issue.pk}
Expand Down

0 comments on commit cef52df

Please # to comment.