diff options
author | Bryan Newbold <bnewbold@archive.org> | 2021-10-06 15:13:03 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2021-10-15 18:15:29 -0700 |
commit | 206969ccebb5007b6c687edd6e09b5c4910e0152 (patch) | |
tree | ec050216c43e69e972d48a702f933546c90e1459 /python/tests | |
parent | b3447503c0aa2e326ce1e46c993be28f907ec23b (diff) | |
download | sandcrawler-206969ccebb5007b6c687edd6e09b5c4910e0152.tar.gz sandcrawler-206969ccebb5007b6c687edd6e09b5c4910e0152.zip |
local-file version of gen_file_metadata
Diffstat (limited to 'python/tests')
-rw-r--r-- | python/tests/test_misc.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/python/tests/test_misc.py b/python/tests/test_misc.py index 29f9e9f..bd18e5c 100644 --- a/python/tests/test_misc.py +++ b/python/tests/test_misc.py @@ -1,7 +1,7 @@ import pytest -from sandcrawler import gen_file_metadata, b32_hex, parse_cdx_line, clean_url +from sandcrawler import gen_file_metadata, gen_file_metadata_path, b32_hex, parse_cdx_line, clean_url def test_gen_file_metadata(): @@ -26,6 +26,18 @@ def test_gen_file_metadata(): assert fm['mimetype'] == 'text/plain' assert fm['size_bytes'] == 8 +def test_gen_file_metadata_path(): + + # valid (but very small) PDF file + file_meta = gen_file_metadata_path('tests/files/dummy.pdf') + assert file_meta == { + 'mimetype': 'application/pdf', + 'md5hex': '2942bfabb3d05332b66eb128e0842cff', + 'sha1hex': '90ffd2359008d82298821d16b21778c5c39aec36', + 'sha256hex': '3df79d34abbca99308e79cb94461c1893582604d68329a41fd4bec1885e6adb4', + 'size_bytes': 13264, + } + def test_b32_hex(): # valid b32 |