1
0
mirror of https://github.com/l1ving/youtube-dl synced 2024-12-31 00:52:52 +08:00

changing test from md5 to filesize, the file changed between download

This commit is contained in:
gcmalloc 2012-10-15 18:27:26 +02:00
parent fc7376016c
commit 591bbe9c90

View File

@ -14,7 +14,7 @@ class DownloadTest(unittest.TestCase):
#calculated with md5sum: #calculated with md5sum:
#md5sum (GNU coreutils) 8.19 #md5sum (GNU coreutils) 8.19
YOUTUBE_MD5 = "ab62e120445e8f68e8c8fddb7bd3ed76" YOUTUBE_SIZE = 1993883
YOUTUBE_URL = "http://www.youtube.com/watch?v=BaW_jenozKc" YOUTUBE_URL = "http://www.youtube.com/watch?v=BaW_jenozKc"
YOUTUBE_FILE = "BaW_jenozKc.mp4" YOUTUBE_FILE = "BaW_jenozKc.mp4"
@ -41,10 +41,8 @@ class DownloadTest(unittest.TestCase):
fd = FileDownloader(json.load(f)) fd = FileDownloader(json.load(f))
fd.add_info_extractor(YoutubeIE()) fd.add_info_extractor(YoutubeIE())
fd.download([DownloadTest.YOUTUBE_URL]) fd.download([DownloadTest.YOUTUBE_URL])
print(os.path.abspath(DownloadTest.YOUTUBE_FILE))
self.assertTrue(os.path.exists(DownloadTest.YOUTUBE_FILE)) self.assertTrue(os.path.exists(DownloadTest.YOUTUBE_FILE))
md5_down_file = md5_for_file(DownloadTest.YOUTUBE_FILE) self.assertEqual(os.path.getsize(DownloadTest.YOUTUBE_FILE), DownloadTest.YOUTUBE_SIZE)
self.assertEqual(md5_down_file, DownloadTest.YOUTUBE_MD5)
def test_dailymotion(self): def test_dailymotion(self):
with open(DownloadTest.PARAMETERS_FILE) as f: with open(DownloadTest.PARAMETERS_FILE) as f:
@ -59,7 +57,6 @@ class DownloadTest(unittest.TestCase):
#this emulate a skip,to be 2.6 compatible #this emulate a skip,to be 2.6 compatible
with open(DownloadTest.PARAMETERS_FILE) as f: with open(DownloadTest.PARAMETERS_FILE) as f:
fd = FileDownloader(json.load(f)) fd = FileDownloader(json.load(f))
print fd
fd.add_info_extractor(MetacafeIE()) fd.add_info_extractor(MetacafeIE())
fd.add_info_extractor(YoutubeIE()) fd.add_info_extractor(YoutubeIE())
fd.download([DownloadTest.METACAFE_URL]) fd.download([DownloadTest.METACAFE_URL])