finish cp module tests with cp.hash_file

This commit is contained in:
Thomas S Hatch 2012-04-04 12:00:52 -06:00
parent f646d9f38f
commit b8227350dc

View File

@ -1,5 +1,6 @@
# Import python libs
import os
import hashlib
# Import salt libs
import integration
@ -173,3 +174,23 @@ class CPModuleTest(integration.ModuleCase):
'salt://fasldkgj/poicxzbn',
])
self.assertFalse(ret2)
def test_hash_file(self):
'''
cp.hash_file
'''
md5_hash = self.run_function(
'cp.hash_file',
[
'salt://grail/scene33',
])
path = self.run_function(
'cp.cache_file',
[
'salt://grail/scene33',
])
with open(path, 'r') as fn_:
self.assertEqual(
md5_hash['hsum'],
hashlib.md5(fn_.read()).hexdigest()
)