summaryrefslogtreecommitdiffstats
path: root/python/tests
diff options
context:
space:
mode:
Diffstat (limited to 'python/tests')
-rw-r--r--python/tests/grobid_metadata_importer.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/python/tests/grobid_metadata_importer.py b/python/tests/grobid_metadata_importer.py
index 7bbabb39..2c8565aa 100644
--- a/python/tests/grobid_metadata_importer.py
+++ b/python/tests/grobid_metadata_importer.py
@@ -1,5 +1,7 @@
+import os
import json
+import base64
import pytest
from fatcat.grobid_metadata_importer import FatcatGrobidMetadataImporter
@@ -34,10 +36,12 @@ def test_file_metadata_parse(grobid_metadata_importer):
with open('tests/files/example_grobid_metadata_lines.tsv', 'r') as f:
f.readline()
raw = f.readline().split('\t')
+ # randomize sha1 so tests are repeatable
+ random_sha1 = "sha1:{}".format(base64.b32encode(os.urandom(20)).decode('utf-8').upper())
fe = grobid_metadata_importer.parse_file_metadata(
- raw[0], json.loads(raw[1]), raw[2], int(raw[3]))
+ random_sha1, json.loads(raw[1]), raw[2], int(raw[3]))
assert fe
- assert fe.sha1 == "d4a841744719518bf8bdd5d91576ccedc55efbb5" # "sha1:2SUEC5CHDFIYX6F52XMRK5WM5XCV565V"
+ #assert fe.sha1 == "d4a841744719518bf8bdd5d91576ccedc55efbb5" # "sha1:2SUEC5CHDFIYX6F52XMRK5WM5XCV565V"
assert fe.md5 == None
assert fe.mimetype == "application/pdf"
assert fe.size == 142710