summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-23 14:24:47 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-23 14:24:50 -0800
commitf99b68aca1ac2cdb4c06207fd43310bd1a741cf7 (patch)
treec64fa14dda3134778bcca0718d54775ac90ff4b1
parente0f70bbbcbcb6232cfb508ad5c0ae637391c4871 (diff)
downloadfatcat-f99b68aca1ac2cdb4c06207fd43310bd1a741cf7.tar.gz
fatcat-f99b68aca1ac2cdb4c06207fd43310bd1a741cf7.zip
improve changelog tests
-rw-r--r--python/fatcat_tools/importers/common.py1
-rw-r--r--python/tests/import_crossref.py5
-rw-r--r--python/tests/import_grobid_metadata.py5
-rw-r--r--python/tests/import_journal_metadata.py6
-rw-r--r--python/tests/import_matched.py5
-rw-r--r--python/tests/import_orcid.py5
6 files changed, 15 insertions, 12 deletions
diff --git a/python/fatcat_tools/importers/common.py b/python/fatcat_tools/importers/common.py
index e7fe2305..b6b20b4c 100644
--- a/python/fatcat_tools/importers/common.py
+++ b/python/fatcat_tools/importers/common.py
@@ -49,7 +49,6 @@ class EntityImporter:
self.api = api
self.bezerk_mode = kwargs.get('bezerk_mode', False)
- self.serial_mode = kwargs.get('serial_mode', False)
self.edit_batch_size = kwargs.get('edit_batch_size', 100)
self.editgroup_description = kwargs.get('editgroup_description')
self.editgroup_extra = kwargs.get('editgroup_extra')
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']