示例#1
0
 def test_get_hash_multi(self, mock_isfile):
     """
     Calculate the hash of files in a directory
     """
     mock_isfile.return_value = False
     chksum = CheckSum('onedir')
     chksum.get_hash(u"./emptydir")
     self.assertEqual(self.increment_hash_emptydir, chksum._increment_hash)
示例#2
0
 def test_get_hash_files(self, mock_isfile, mock_open):
     """
     Test calculating the hash of a file
     """
     mock_isfile.return_value = True
     mock_open.return_value = self.fake_file
     chksum = CheckSum('onefile')
     chksum.get_hash('onefile')
     self.assertEqual(self.increment_hash_one, chksum._increment_hash)
     chksum.get_hash('otherfile')
     self.assertEqual(self.increment_hash_multi, chksum._increment_hash)