From 6eb0555742dc1b7290c55a17b02ff108ae03591d Mon Sep 17 00:00:00 2001 From: Siddharth Ravikumar Date: Thu, 26 Feb 2015 02:38:52 -0500 Subject: modded combox.file.hash_file function -- added new arg `file_content' - `file_content' is set to None by default - If `file_content' is not None, hash of this is returned. Updated the test for hash_file function. modified: combox/file.py modified: tests/file_test.py --- tests/file_test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/file_test.py b/tests/file_test.py index 807ed23..7c041b7 100644 --- a/tests/file_test.py +++ b/tests/file_test.py @@ -88,10 +88,12 @@ class TestFile(object): """ Tests the hashing function - hash_file """ - fhash = hash_file(self.TEST_FILE) fcontent = read_file(self.TEST_FILE) + fhash_0 = hash_file(self.TEST_FILE) + fhash_1 = hash_file(self.TEST_FILE, fcontent) - assert fhash == sha512(fcontent).hexdigest() + assert fhash_0 == sha512(fcontent).hexdigest() + assert fhash_1 == sha512(fcontent).hexdigest() def test_relativepath(self): -- cgit v1.2.3