]> Raphaƫl G. Git Repositories - youtubedl/blob - test/test_playlists.py
Imported Upstream version 2013.08.29
[youtubedl] / test / test_playlists.py
1 #!/usr/bin/env python
2
3 import sys
4 import unittest
5 import json
6
7 # Allow direct execution
8 import os
9 sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
10
11 from youtube_dl.extractor import DailymotionPlaylistIE, VimeoChannelIE
12 from youtube_dl.utils import *
13
14 from helper import FakeYDL
15
16 class TestPlaylists(unittest.TestCase):
17 def assertIsPlaylist(self, info):
18 """Make sure the info has '_type' set to 'playlist'"""
19 self.assertEqual(info['_type'], 'playlist')
20
21 def test_dailymotion_playlist(self):
22 dl = FakeYDL()
23 ie = DailymotionPlaylistIE(dl)
24 result = ie.extract('http://www.dailymotion.com/playlist/xv4bw_nqtv_sport/1#video=xl8v3q')
25 self.assertIsPlaylist(result)
26 self.assertEqual(result['title'], u'SPORT')
27 self.assertTrue(len(result['entries']) > 20)
28
29 def test_vimeo_channel(self):
30 dl = FakeYDL()
31 ie = VimeoChannelIE(dl)
32 result = ie.extract('http://vimeo.com/channels/tributes')
33 self.assertIsPlaylist(result)
34 self.assertEqual(result['title'], u'Vimeo Tributes')
35 self.assertTrue(len(result['entries']) > 24)
36
37 if __name__ == '__main__':
38 unittest.main()