mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
finish cp module tests with cp.hash_file
This commit is contained in:
parent
f646d9f38f
commit
b8227350dc
@ -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()
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user