Merge remote-tracking branch 'jaimeMF/opus-fix'
[youtube-dl] / test / test_dailymotion_subtitles.py
index bcd9f79f659d4cc76737bf6c587d2e82dcf9079d..e655d280deb0640e32f71a3d76abac16e7d7f68e 100644 (file)
@@ -2,8 +2,6 @@
 
 import sys
 import unittest
-import json
-import io
 import hashlib
 
 # Allow direct execution
@@ -12,7 +10,7 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 
 from youtube_dl.extractor import DailymotionIE
 from youtube_dl.utils import *
-from helper import FakeYDL
+from .helper import FakeYDL
 
 md5 = lambda s: hashlib.md5(s.encode('utf-8')).hexdigest()
 
@@ -40,20 +38,25 @@ class TestDailymotionSubtitles(unittest.TestCase):
         subtitles = self.getSubtitles()
         self.assertEqual(md5(subtitles['fr']), '594564ec7d588942e384e920e5341792')
     def test_allsubtitles(self):
+        self.DL.params['writesubtitles'] = True
         self.DL.params['allsubtitles'] = True
         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.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.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
         subtitles = self.getSubtitles()
         self.assertEqual(len(subtitles), 0)