aboutsummaryrefslogtreecommitdiff
path: root/tests/uploader
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-10-17 10:31:10 -0500
committerFrederick Muriuki Muriithi2024-10-17 11:32:28 -0500
commit8745a5db5c91d49befd76a0e6ea8f06e7a878180 (patch)
tree239083fbe6c70b6c69e4283a4560499e80013c1a /tests/uploader
parent85215361b561d332cab954ea68438a2d442c96d8 (diff)
downloadgn-uploader-8745a5db5c91d49befd76a0e6ea8f06e7a878180.tar.gz
Add test for function to compute file hash.
Diffstat (limited to 'tests/uploader')
-rw-r--r--tests/uploader/test_files.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/uploader/test_files.py b/tests/uploader/test_files.py
new file mode 100644
index 0000000..cb22fff
--- /dev/null
+++ b/tests/uploader/test_files.py
@@ -0,0 +1,17 @@
+"""Tests functions in the `uploader.files` module."""
+from pathlib import Path
+
+import pytest
+
+from uploader.files import sha256_digest_over_file
+
+@pytest.mark.unit_test
+@pytest.mark.parametrize(
+ "filepath,expectedhash",
+ ((Path("tests/test_data/average.tsv.zip"),
+ "a371c654c095c030edad468e1c3d6b176ea8adfbcd91a322afd37779044478d9"),
+ (Path("tests/test_data/standarderror.tsv"),
+ "a08332e0b06391d50eecb722f69d85fbdf374a2d77713ee879d3fd6c60419d55")))
+def test_sha256_digest_over_file(filepath: Path, expectedhash: str):
+ """Test the `sha256_digest_over_file` function."""
+ assert sha256_digest_over_file(filepath) == expectedhash