From 9c6e9a4532f7856d3bff0e14e17cc2084bc5b022 Mon Sep 17 00:00:00 2001 From: gcmalloc Date: Wed, 24 Oct 2012 00:13:16 +0200 Subject: [PATCH] adding xnxx test --- test/test_download.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/test_download.py b/test/test_download.py index d90d1583a..612280e6c 100644 --- a/test/test_download.py +++ b/test/test_download.py @@ -9,7 +9,7 @@ from youtube_dl.InfoExtractors import YoutubeIE, DailymotionIE from youtube_dl.InfoExtractors import MetacafeIE, BlipTVIE from youtube_dl.InfoExtractors import XVideosIE, VimeoIE from youtube_dl.InfoExtractors import SoundcloudIE, StanfordOpenClassroomIE -from youtube_dl.InfoExtractors import CollegeHumorIE +from youtube_dl.InfoExtractors import CollegeHumorIE, XNXXIE class DownloadTest(unittest.TestCase): @@ -54,6 +54,10 @@ class DownloadTest(unittest.TestCase): COLLEGEHUMOR_URL = "http://www.collegehumor.com/video/6830834/mitt-romney-style-gangnam-style-parody" COLLEGEHUMOR_FILE = "" + XNXX_MD5 = "5f0469c8d1dfd1bc38c8e6deb5e0a21d" + XNXX_URL = "http://video.xnxx.com/video1135332/lida_naked_funny_actress_5_" + XNXX_FILE = "1135332.flv" + def test_youtube(self): #let's download a file from youtube with open(DownloadTest.PARAMETERS_FILE) as f: @@ -136,6 +140,15 @@ class DownloadTest(unittest.TestCase): md5_down_file = md5_for_file(DownloadTest.COLLEGEHUMOR_FILE) self.assertEqual(md5_down_file, DownloadTest.COLLEGEHUMOR_MD5) + def test_xnxx(self): + with open(DownloadTest.PARAMETERS_FILE) as f: + fd = FileDownloader(json.load(f)) + fd.add_info_extractor(XNXXIE()) + fd.download([DownloadTest.XNXX_URL]) + self.assertTrue(os.path.exists(DownloadTest.XNXX_FILE)) + md5_down_file = md5_for_file(DownloadTest.XNXX_FILE) + self.assertEqual(md5_down_file, DownloadTest.XNXX_MD5) + def tearDown(self): if os.path.exists(DownloadTest.YOUTUBE_FILE): os.remove(DownloadTest.YOUTUBE_FILE) @@ -155,6 +168,8 @@ class DownloadTest(unittest.TestCase): os.remove(DownloadTest.STANDFORD_FILE) if os.path.exists(DownloadTest.COLLEGEHUMOR_FILE): os.remove(DownloadTest.COLLEGEHUMOR_FILE) + if os.path.exists(DownloadTest.XNXX_FILE): + os.remove(DownloadTest.XNXX_FILE) def md5_for_file(filename, block_size=2**20): with open(filename) as f: -- 2.22.2