aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/test_file_utils.py
diff options
context:
space:
mode:
authorBonfaceKilz2021-02-12 15:18:21 +0300
committerBonfaceKilz2021-02-12 15:36:41 +0300
commit21a4a847456fde5fcc6072df0d0fc36992da283d (patch)
treef6921e2e740f3ce3f528258044aad1dbf938bd1e /tests/unit/test_file_utils.py
parentedd18bffdb179db75769b5a47b9258e5eded5aaf (diff)
downloadgenenetwork3-21a4a847456fde5fcc6072df0d0fc36992da283d.tar.gz
Add function for computing the hash of a directory
Diffstat (limited to 'tests/unit/test_file_utils.py')
-rw-r--r--tests/unit/test_file_utils.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/unit/test_file_utils.py b/tests/unit/test_file_utils.py
new file mode 100644
index 0000000..e6109bb
--- /dev/null
+++ b/tests/unit/test_file_utils.py
@@ -0,0 +1,20 @@
+"""Test cases for procedures defined in file_utils.py"""
+import os
+import unittest
+
+from gn3.file_utils import get_dir_hash
+
+
+class TestFileUtils(unittest.TestCase):
+ """Test cases for procedures defined in file_utils.py"""
+ def test_get_dir_hash(self):
+ """Test that a directory is hashed correctly"""
+ test_dir = os.path.join(os.path.dirname(__file__), "test_data")
+ self.assertEqual("928a0e2e4846b4b3c2881d9c1d6cfce4",
+ get_dir_hash(test_dir))
+
+ def test_get_dir_hash_non_existent_dir(self):
+ """Test thata an error is raised when the dir does not exist"""
+ self.assertRaises(FileNotFoundError,
+ get_dir_hash,
+ "/non-existent-file")