1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-07 07:57:23 +08:00

changed md5 to sha256

This commit is contained in:
wawxxjm 2019-12-09 20:21:53 -05:00 committed by GitHub
parent d83fe1f86a
commit 76bfb7fa21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,9 +56,9 @@ class YoutubeDL(youtube_dl.YoutubeDL):
return super(YoutubeDL, self).process_info(info_dict)
def _file_md5(fn):
def _file_sha256(fn):
with open(fn, 'rb') as f:
return hashlib.md5(f.read()).hexdigest()
return hashlib.sha256(f.read()).hexdigest()
defs = gettestcases()
@ -223,9 +223,9 @@ def generator(test_case, tname):
'Expected %s to be at least %s, but it\'s only %s ' %
(tc_filename, format_bytes(expected_minsize),
format_bytes(got_fsize)))
if 'md5' in tc:
md5_for_file = _file_md5(tc_filename)
self.assertEqual(tc['md5'], md5_for_file)
if 'sha256' in tc:
sha256_for_file = _file_sha256(tc_filename)
self.assertEqual(tc['sha256'], sha256_for_file)
# Finally, check test cases' data again but this time against
# extracted data from info JSON file written during processing
info_json_fn = os.path.splitext(tc_filename)[0] + '.info.json'