[subtitles] Added tests to check correct behavior when no subtitles are
authorIsmael Mejia <iemejia@gmail.com>
Thu, 8 Aug 2013 20:22:33 +0000 (22:22 +0200)
committerIsmael Mejia <iemejia@gmail.com>
Thu, 8 Aug 2013 20:22:33 +0000 (22:22 +0200)
available

test/test_dailymotion_subtitles.py
test/test_youtube_subtitles.py

index 26c40493f872f57e250f9138f8bca3064eeff879..efc4e574ff50bb6237dd8a1bba78f35dfa99256d 100644 (file)
@@ -27,14 +27,14 @@ class TestDailymotionSubtitles(unittest.TestCase):
     def getSubtitles(self):
         info_dict = self.getInfoDict()
         return info_dict[0]['subtitles']
-    def test_no_subtitles(self):
+    def test_no_writesubtitles(self):
         subtitles = self.getSubtitles()
         self.assertEqual(subtitles, None)
     def test_subtitles(self):
         self.DL.params['writesubtitles'] = True
         subtitles = self.getSubtitles()
         self.assertEqual(md5(subtitles['en']), '976553874490cba125086bbfea3ff76f')
-    def test_subtitles_fr(self):
+    def test_subtitles_lang(self):
         self.DL.params['writesubtitles'] = True
         self.DL.params['subtitleslang'] = 'fr'
         subtitles = self.getSubtitles()
@@ -52,6 +52,11 @@ class TestDailymotionSubtitles(unittest.TestCase):
         self.DL.params['subtitleslang'] = 'en'
         subtitles = self.getSubtitles()
         self.assertTrue(len(subtitles.keys()) == 0)
+    def test_nosubtitles(self):
+        self.url = 'http://www.dailymotion.com/video/x12u166_le-zapping-tele-star-du-08-aout-2013_tv'
+        self.DL.params['allsubtitles'] = True
+        subtitles = self.getSubtitles()
+        self.assertEqual(len(subtitles), 0)
 
 if __name__ == '__main__':
     unittest.main()
index aa6a1a434288cab95b81428b841bad2751179206..e40243077f99d7a7c137301e042ddcbaa665d074 100644 (file)
@@ -27,7 +27,7 @@ class TestYoutubeSubtitles(unittest.TestCase):
     def getSubtitles(self):
         info_dict = self.getInfoDict()
         return info_dict[0]['subtitles']        
-    def test_youtube_no_subtitles(self):
+    def test_youtube_no_writesubtitles(self):
         self.DL.params['writesubtitles'] = False
         subtitles = self.getSubtitles()
         self.assertEqual(subtitles, None)
@@ -35,7 +35,7 @@ class TestYoutubeSubtitles(unittest.TestCase):
         self.DL.params['writesubtitles'] = True
         subtitles = self.getSubtitles()
         self.assertEqual(md5(subtitles['en']), '4cd9278a35ba2305f47354ee13472260')
-    def test_youtube_subtitles_it(self):
+    def test_youtube_subtitles_lang(self):
         self.DL.params['writesubtitles'] = True
         self.DL.params['subtitleslang'] = 'it'
         subtitles = self.getSubtitles()
@@ -64,6 +64,12 @@ class TestYoutubeSubtitles(unittest.TestCase):
         self.DL.params['subtitleslang'] = 'it'
         subtitles = self.getSubtitles()
         self.assertTrue(subtitles['it'] is not None)
+    def test_youtube_nosubtitles(self):
+        self.url = 'sAjKT8FhjI8'
+        self.DL.params['allsubtitles'] = True
+        subtitles = self.getSubtitles()
+        self.assertEqual(len(subtitles), 0)
+
 
 if __name__ == '__main__':
     unittest.main()