aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_download.py19
-rw-r--r--test/tests.json72
2 files changed, 53 insertions, 38 deletions
diff --git a/test/test_download.py b/test/test_download.py
index 238195050..4ea889740 100644
--- a/test/test_download.py
+++ b/test/test_download.py
@@ -54,10 +54,9 @@ class TestDownload(unittest.TestCase):
self.tearDown()
def tearDown(self):
- for files in [ test['files'] for test in self.defs ]:
- for fn, md5 in files:
- if os.path.exists(fn):
- os.remove(fn)
+ for fn in [ test.get('file', False) for test in self.defs ]:
+ if fn and os.path.exists(fn):
+ os.remove(fn)
### Dynamically generate tests
@@ -68,6 +67,9 @@ def generator(test_case):
if not ie._WORKING:
print('Skipping: IE marked as not _WORKING')
return
+ if not test_case['file']:
+ print('Skipping: No output file specified')
+ return
if 'skip' in test_case:
print('Skipping: {0}'.format(test_case['skip']))
return
@@ -82,11 +84,10 @@ def generator(test_case):
fd.add_info_extractor(getattr(youtube_dl.InfoExtractors, ien + 'IE')())
fd.download([test_case['url']])
- for filename, md5 in test_case['files']:
- self.assertTrue(os.path.exists(filename))
- if md5:
- md5_for_file = _file_md5(filename)
- self.assertEqual(md5_for_file, md5)
+ self.assertTrue(os.path.exists(test_case['file']))
+ if 'md5' in test_case:
+ md5_for_file = _file_md5(test_case['file'])
+ self.assertEqual(md5_for_file, test_case['md5'])
info_dict = fd.processed_info_dicts[0]
for (info_field, value) in test_case.get('info_dict', {}).items():
if value.startswith('md5:'):
diff --git a/test/tests.json b/test/tests.json
index 784e09fb3..23843432a 100644
--- a/test/tests.json
+++ b/test/tests.json
@@ -1,8 +1,8 @@
[
{
"name": "Youtube",
- "url": "http://www.youtube.com/watch?v=BaW_jenozKc",
- "files": [[ "BaW_jenozKc.mp4", false ]],
+ "url": "http://www.youtube.com/watch?v=BaW_jenozKc",
+ "file": "BaW_jenozKc.mp4",
"info_dict": {
"title": "youtube-dl test video \"'/\\ä↭𝕐",
"uploader": "Philipp Hagemeister",
@@ -13,29 +13,33 @@
},
{
"name": "Dailymotion",
- "url": "http://www.dailymotion.com/video/x33vw9_tutoriel-de-youtubeur-dl-des-video_tech",
- "files": [[ "x33vw9.mp4", "392c4b85a60a90dc4792da41ce3144eb" ]]
+ "md5": "392c4b85a60a90dc4792da41ce3144eb",
+ "url": "http://www.dailymotion.com/video/x33vw9_tutoriel-de-youtubeur-dl-des-video_tech",
+ "file": "x33vw9.mp4"
},
{
"name": "Metacafe",
- "add_ie": [ "Youtube" ],
- "url": "http://metacafe.com/watch/yt-_aUehQsCQtM/the_electric_company_short_i_pbs_kids_go/",
- "files": [[ "_aUehQsCQtM.flv", false ]]
+ "add_ie": ["Youtube"],
+ "url": "http://metacafe.com/watch/yt-_aUehQsCQtM/the_electric_company_short_i_pbs_kids_go/",
+ "file": "_aUehQsCQtM.flv"
},
{
"name": "BlipTV",
- "url": "http://blip.tv/cbr/cbr-exclusive-gotham-city-imposters-bats-vs-jokerz-short-3-5796352",
- "files": [[ "5779306.m4v", "b2d849efcf7ee18917e4b4d9ff37cafe" ]]
+ "md5": "b2d849efcf7ee18917e4b4d9ff37cafe",
+ "url": "http://blip.tv/cbr/cbr-exclusive-gotham-city-imposters-bats-vs-jokerz-short-3-5796352",
+ "file": "5779306.m4v"
},
{
"name": "XVideos",
- "url": "http://www.xvideos.com/video939581/funny_porns_by_s_-1",
- "files": [[ "939581.flv", "1d0c835822f0a71a7bf011855db929d0" ]]
+ "md5": "1d0c835822f0a71a7bf011855db929d0",
+ "url": "http://www.xvideos.com/video939581/funny_porns_by_s_-1",
+ "file": "939581.flv"
},
{
"name": "Vimeo",
- "url": "http://vimeo.com/56015672",
- "files": [[ "56015672.mp4", "8879b6cc097e987f02484baf890129e5" ]],
+ "md5": "8879b6cc097e987f02484baf890129e5",
+ "url": "http://vimeo.com/56015672",
+ "file": "56015672.mp4",
"info_dict": {
"title": "youtube-dl test video - ★ \" ' 幸 / \\ ä ↭ 𝕐",
"uploader": "Filippo Valsorda",
@@ -46,60 +50,70 @@
},
{
"name": "Soundcloud",
- "url": "http://soundcloud.com/ethmusic/lostin-powers-she-so-heavy",
- "files": [[ "62986583.mp3", "ebef0a451b909710ed1d7787dddbf0d7" ]]
+ "md5": "ebef0a451b909710ed1d7787dddbf0d7",
+ "url": "http://soundcloud.com/ethmusic/lostin-powers-she-so-heavy",
+ "file": "62986583.mp3"
},
{
"name": "StanfordOpenClassroom",
- "url": "http://openclassroom.stanford.edu/MainFolder/VideoPage.php?course=PracticalUnix&video=intro-environment&speed=100",
- "files": [[ "PracticalUnix_intro-environment.mp4", "544a9468546059d4e80d76265b0443b8" ]]
+ "md5": "544a9468546059d4e80d76265b0443b8",
+ "url": "http://openclassroom.stanford.edu/MainFolder/VideoPage.php?course=PracticalUnix&video=intro-environment&speed=100",
+ "file": "PracticalUnix_intro-environment.mp4"
},
{
"name": "XNXX",
- "url": "http://video.xnxx.com/video1135332/lida_naked_funny_actress_5_",
- "files": [[ "1135332.flv", "0831677e2b4761795f68d417e0b7b445" ]]
+ "md5": "0831677e2b4761795f68d417e0b7b445",
+ "url": "http://video.xnxx.com/video1135332/lida_naked_funny_actress_5_",
+ "file": "1135332.flv"
},
{
"name": "Youku",
"url": "http://v.youku.com/v_show/id_XNDgyMDQ2NTQw.html",
- "files": [[ "XNDgyMDQ2NTQw_part00.flv", "ffe3f2e435663dc2d1eea34faeff5b5b" ]],
+ "file": "XNDgyMDQ2NTQw_part00.flv",
+ "md5": "ffe3f2e435663dc2d1eea34faeff5b5b",
"params": { "test": false }
},
{
"name": "NBA",
"url": "http://www.nba.com/video/games/nets/2012/12/04/0021200253-okc-bkn-recap.nba/index.html",
- "files": [[ "0021200253-okc-bkn-recap.nba.mp4", "c0edcfc37607344e2ff8f13c378c88a4" ]]
+ "file": "0021200253-okc-bkn-recap.nba.mp4",
+ "md5": "c0edcfc37607344e2ff8f13c378c88a4"
},
{
"name": "JustinTV",
"url": "http://www.twitch.tv/thegamedevhub/b/296128360",
- "files": [[ "296128360.flv", "ecaa8a790c22a40770901460af191c9a" ]]
+ "file": "296128360.flv",
+ "md5": "ecaa8a790c22a40770901460af191c9a"
},
{
"name": "MyVideo",
"url": "http://www.myvideo.de/watch/8229274/bowling_fail_or_win",
- "files": [[ "8229274.flv", "2d2753e8130479ba2cb7e0a37002053e" ]]
+ "file": "8229274.flv",
+ "md5": "2d2753e8130479ba2cb7e0a37002053e"
},
{
"name": "Escapist",
"url": "http://www.escapistmagazine.com/videos/view/the-escapist-presents/6618-Breaking-Down-Baldurs-Gate",
- "files": [[ "6618-Breaking-Down-Baldurs-Gate.flv", "c6793dbda81388f4264c1ba18684a74d" ]],
+ "file": "6618-Breaking-Down-Baldurs-Gate.flv",
+ "md5": "c6793dbda81388f4264c1ba18684a74d",
"skip": "Fails with timeout on Travis"
},
{
"name": "GooglePlus",
"url": "https://plus.google.com/u/0/108897254135232129896/posts/ZButuJc6CtH",
- "files": [[ "ZButuJc6CtH.flv", false ]]
+ "file": "ZButuJc6CtH.flv"
},
{
"name": "FunnyOrDie",
"url": "http://www.funnyordie.com/videos/0732f586d7/heart-shaped-box-literal-video-version",
- "files": [[ "0732f586d7.mp4", "f647e9e90064b53b6e046e75d0241fbd" ]]
+ "file": "0732f586d7.mp4",
+ "md5": "f647e9e90064b53b6e046e75d0241fbd"
},
{
"name": "TweetReel",
"url": "http://tweetreel.com/?77smq",
- "files": [[ "77smq.mov", "56b4d9ca9de467920f3f99a6d91255d6" ]],
+ "file": "77smq.mov",
+ "md5": "56b4d9ca9de467920f3f99a6d91255d6",
"info_dict": {
"uploader": "itszero",
"uploader_id": "itszero",
@@ -110,8 +124,8 @@
{
"name": "Steam",
"url": "http://store.steampowered.com/video/105600/",
- "files": [[ "81300.flv", "f870007cee7065d7c76b88f0a45ecc07" ],
- [ "80859.flv", "61aaf31a5c5c3041afb58fb83cbb5751" ]],
+ "file": "81300.flv",
+ "md5": "f870007cee7065d7c76b88f0a45ecc07",
"info_dict": {
"title": "Terraria 1.1 Trailer"
}