]> Raphaƫl G. Git Repositories - youtubedl/blobdiff - test/test_dailymotion_subtitles.py
update changelog.
[youtubedl] / test / test_dailymotion_subtitles.py
index 83c65d57e60870be10b25c116ebad6fd20cc8122..c596415c4189624d254f72afd7b7bd7452d9fe50 100644 (file)
@@ -1,20 +1,16 @@
 #!/usr/bin/env python
 
 #!/usr/bin/env python
 
+# Allow direct execution
+import os
 import sys
 import unittest
 import sys
 import unittest
-import json
-import io
-import hashlib
+sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 
 
-# Allow direct execution
-import os
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from test.helper import FakeYDL, global_setup, md5
+global_setup()
 
 
-from youtube_dl.extractor import DailymotionIE
-from youtube_dl.utils import *
-from helper import FakeYDL
 
 
-md5 = lambda s: hashlib.md5(s.encode('utf-8')).hexdigest()
+from youtube_dl.extractor import DailymotionIE
 
 class TestDailymotionSubtitles(unittest.TestCase):
     def setUp(self):
 
 class TestDailymotionSubtitles(unittest.TestCase):
     def setUp(self):
@@ -45,15 +41,18 @@ class TestDailymotionSubtitles(unittest.TestCase):
         subtitles = self.getSubtitles()
         self.assertEqual(len(subtitles.keys()), 5)
     def test_list_subtitles(self):
         subtitles = self.getSubtitles()
         self.assertEqual(len(subtitles.keys()), 5)
     def test_list_subtitles(self):
+        self.DL.expect_warning(u'Automatic Captions not supported by this server')
         self.DL.params['listsubtitles'] = True
         info_dict = self.getInfoDict()
         self.assertEqual(info_dict, None)
     def test_automatic_captions(self):
         self.DL.params['listsubtitles'] = True
         info_dict = self.getInfoDict()
         self.assertEqual(info_dict, None)
     def test_automatic_captions(self):
+        self.DL.expect_warning(u'Automatic Captions not supported by this server')
         self.DL.params['writeautomaticsub'] = True
         self.DL.params['subtitleslang'] = ['en']
         subtitles = self.getSubtitles()
         self.assertTrue(len(subtitles.keys()) == 0)
     def test_nosubtitles(self):
         self.DL.params['writeautomaticsub'] = True
         self.DL.params['subtitleslang'] = ['en']
         subtitles = self.getSubtitles()
         self.assertTrue(len(subtitles.keys()) == 0)
     def test_nosubtitles(self):
+        self.DL.expect_warning(u'video doesn\'t have subtitles')
         self.url = 'http://www.dailymotion.com/video/x12u166_le-zapping-tele-star-du-08-aout-2013_tv'
         self.DL.params['writesubtitles'] = True
         self.DL.params['allsubtitles'] = True
         self.url = 'http://www.dailymotion.com/video/x12u166_le-zapping-tele-star-du-08-aout-2013_tv'
         self.DL.params['writesubtitles'] = True
         self.DL.params['allsubtitles'] = True