From f99b68aca1ac2cdb4c06207fd43310bd1a741cf7 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 23 Jan 2019 14:24:47 -0800 Subject: improve changelog tests --- python/tests/import_crossref.py | 5 +++-- python/tests/import_grobid_metadata.py | 5 +++-- python/tests/import_journal_metadata.py | 6 +++--- python/tests/import_matched.py | 5 +++-- python/tests/import_orcid.py | 5 +++-- 5 files changed, 15 insertions(+), 11 deletions(-) (limited to 'python/tests') diff --git a/python/tests/import_crossref.py b/python/tests/import_crossref.py index db49bb7f..8eeb8072 100644 --- a/python/tests/import_crossref.py +++ b/python/tests/import_crossref.py @@ -20,12 +20,13 @@ def test_crossref_importer_batch(crossref_importer): JsonLinePusher(crossref_importer, f).run() def test_crossref_importer(crossref_importer): + last_index = crossref_importer.api.get_changelog(limit=1)[0].index with open('tests/files/crossref-works.2018-01-21.badsample.json', 'r') as f: crossref_importer.bezerk_mode = True JsonLinePusher(crossref_importer, f).run() # fetch most recent editgroup - changes = crossref_importer.api.get_changelog(limit=1) - eg = changes[0].editgroup + change = crossref_importer.api.get_changelog_entry(index=last_index+1) + eg = change.editgroup assert eg.description assert "crossref" in eg.description.lower() assert eg.extra['git_rev'] diff --git a/python/tests/import_grobid_metadata.py b/python/tests/import_grobid_metadata.py index f00479d8..698b36be 100644 --- a/python/tests/import_grobid_metadata.py +++ b/python/tests/import_grobid_metadata.py @@ -50,13 +50,14 @@ def test_file_metadata_parse(grobid_metadata_importer): # TODO: use API to check that entities actually created... def test_grobid_metadata_importer(grobid_metadata_importer): + last_index = grobid_metadata_importer.api.get_changelog(limit=1)[0].index with open('tests/files/example_grobid_metadata_lines.tsv', 'r') as f: grobid_metadata_importer.bezerk_mode = True LinePusher(grobid_metadata_importer, f).run() # fetch most recent editgroup - changes = grobid_metadata_importer.api.get_changelog(limit=1) - eg = changes[0].editgroup + change = grobid_metadata_importer.api.get_changelog_entry(index=last_index+1) + eg = change.editgroup assert eg.description assert "grobid" in eg.description.lower() assert eg.extra['git_rev'] diff --git a/python/tests/import_journal_metadata.py b/python/tests/import_journal_metadata.py index 0263f706..1663da05 100644 --- a/python/tests/import_journal_metadata.py +++ b/python/tests/import_journal_metadata.py @@ -14,14 +14,14 @@ def test_journal_metadata_importer_batch(journal_metadata_importer): CsvPusher(journal_metadata_importer, f).run() def test_journal_metadata_importer(journal_metadata_importer): + last_index = journal_metadata_importer.api.get_changelog(limit=1)[0].index with open('tests/files/journal_extra_metadata.snip.csv', 'r') as f: journal_metadata_importer.bezerk_mode = True - journal_metadata_importer.serial_mode = True CsvPusher(journal_metadata_importer, f).run() # fetch most recent editgroup - changes = journal_metadata_importer.api.get_changelog(limit=1) - eg = changes[0].editgroup + change = journal_metadata_importer.api.get_changelog_entry(index=last_index+1) + eg = change.editgroup assert eg.description assert "container" in eg.description.lower() assert eg.extra['git_rev'] diff --git a/python/tests/import_matched.py b/python/tests/import_matched.py index a58c402f..22bc45ad 100644 --- a/python/tests/import_matched.py +++ b/python/tests/import_matched.py @@ -15,13 +15,14 @@ def test_matched_importer_batch(matched_importer): JsonLinePusher(matched_importer, f).run() def test_matched_importer(matched_importer): + last_index = matched_importer.api.get_changelog(limit=1)[0].index with open('tests/files/example_matched.json', 'r') as f: matched_importer.bezerk_mode = True JsonLinePusher(matched_importer, f).run() # fetch most recent editgroup - changes = matched_importer.api.get_changelog(limit=1) - eg = changes[0].editgroup + change = matched_importer.api.get_changelog_entry(index=last_index+1) + eg = change.editgroup assert eg.description assert "file-to-release" in eg.description.lower() assert eg.extra['git_rev'] diff --git a/python/tests/import_orcid.py b/python/tests/import_orcid.py index 9e898521..4055091d 100644 --- a/python/tests/import_orcid.py +++ b/python/tests/import_orcid.py @@ -16,13 +16,14 @@ def test_orcid_importer_badid(orcid_importer): # TODO: use API to check that entities actually created... def test_orcid_importer(orcid_importer): + last_index = orcid_importer.api.get_changelog(limit=1)[0].index with open('tests/files/0000-0001-8254-7103.json', 'r') as f: orcid_importer.bezerk_mode = True JsonLinePusher(orcid_importer, f).run() # fetch most recent editgroup - changes = orcid_importer.api.get_changelog(limit=1) - eg = changes[0].editgroup + change = orcid_importer.api.get_changelog_entry(index=last_index+1) + eg = change.editgroup assert eg.description assert "orcid" in eg.description.lower() assert eg.extra['git_rev'] -- cgit v1.2.3