aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests/import_ingest.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2020-01-15 14:13:34 -0800
committerBryan Newbold <bnewbold@robocracy.org>2020-01-15 14:13:34 -0800
commit689da76d1c759d6368d760b4a1fa942e16095a40 (patch)
treeca78cd6841875b3c7d55d046b3c7a206e604b60f /python/tests/import_ingest.py
parenta02d51650bb5a3165ec89e822f43ff98807d01c3 (diff)
downloadfatcat-689da76d1c759d6368d760b4a1fa942e16095a40.tar.gz
fatcat-689da76d1c759d6368d760b4a1fa942e16095a40.zip
ingest: improve tests, support old ingest results
Diffstat (limited to 'python/tests/import_ingest.py')
-rw-r--r--python/tests/import_ingest.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/python/tests/import_ingest.py b/python/tests/import_ingest.py
index 7c0a85cd..5089d99e 100644
--- a/python/tests/import_ingest.py
+++ b/python/tests/import_ingest.py
@@ -56,3 +56,19 @@ def test_ingest_dict_parse(ingest_importer):
if u.rel == "webarchive":
assert u.url.startswith("https://web.archive.org/")
assert len(f.release_ids) == 1
+
+def test_ingest_dict_parse_old(ingest_importer):
+ with open('tests/files/example_ingest.old.json', 'r') as f:
+ raw = json.loads(f.readline())
+ f = ingest_importer.parse_record(raw)
+ assert f.sha1 == "00242a192acc258bdfdb151943419437f440c313"
+ assert f.md5 == "f4de91152c7ab9fdc2a128f962faebff"
+ assert f.mimetype == "application/pdf"
+ assert f.size == 255629
+ assert len(f.urls) == 2
+ for u in f.urls:
+ if u.rel == "web":
+ assert u.url.startswith("http://journals.plos.org")
+ if u.rel == "webarchive":
+ assert u.url.startswith("https://web.archive.org/")
+ assert len(f.release_ids) == 1