summaryrefslogtreecommitdiffstats
path: root/python/tests/import_ingest.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2020-11-05 17:29:44 -0800
committerBryan Newbold <bnewbold@robocracy.org>2020-11-05 17:29:44 -0800
commitcad812bf78f7363e698139cd7b95d7434f8ae4bb (patch)
tree3896497c20ff0b257fe425cf56b33a3e79814aee /python/tests/import_ingest.py
parent8b6b1447cc37fb76865fd80377c55463e59db3b9 (diff)
downloadfatcat-cad812bf78f7363e698139cd7b95d7434f8ae4bb.tar.gz
fatcat-cad812bf78f7363e698139cd7b95d7434f8ae4bb.zip
ingest: tests for basic XML ingest
Diffstat (limited to 'python/tests/import_ingest.py')
-rw-r--r--python/tests/import_ingest.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/python/tests/import_ingest.py b/python/tests/import_ingest.py
index 05287af4..21552fb9 100644
--- a/python/tests/import_ingest.py
+++ b/python/tests/import_ingest.py
@@ -41,6 +41,23 @@ def test_ingest_importer(ingest_importer):
assert counts['exists'] == 1
assert counts['skip'] == 1
+def test_ingest_importer_xml(ingest_importer):
+ last_index = ingest_importer.api.get_changelog(limit=1)[0].index
+ with open('tests/files/example_ingest_xml.json', 'r') as f:
+ ingest_importer.bezerk_mode = True
+ counts = JsonLinePusher(ingest_importer, f).run()
+ assert counts['insert'] == 1
+ assert counts['exists'] == 0
+ assert counts['skip'] == 0
+
+ # fetch most recent editgroup
+ change = ingest_importer.api.get_changelog_entry(index=last_index+1)
+ eg = change.editgroup
+ assert eg.description
+ assert "crawled from web" in eg.description.lower()
+ assert eg.extra['git_rev']
+ assert "fatcat_tools.IngestFileResultImporter" in eg.extra['agent']
+
def test_ingest_importer_stage(ingest_importer, api):
"""
Tests that ingest importer correctly handles release stage matching