diff options
Diffstat (limited to 'test/test_youtube_lists.py')
-rw-r--r-- | test/test_youtube_lists.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/test/test_youtube_lists.py b/test/test_youtube_lists.py index b94b733..50f42d1 100644 --- a/test/test_youtube_lists.py +++ b/test/test_youtube_lists.py @@ -1,18 +1,16 @@ #!/usr/bin/env python3 -from __future__ import unicode_literals # Allow direct execution import os import sys import unittest + sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from test.helper import FakeYDL, is_download_test -from hypervideo_dl.extractor import ( - YoutubeIE, - YoutubeTabIE, -) +from test.helper import FakeYDL, is_download_test +from hypervideo_dl.extractor import YoutubeIE, YoutubeTabIE +from hypervideo_dl.utils import ExtractorError @is_download_test @@ -56,6 +54,18 @@ class TestYoutubeLists(unittest.TestCase): self.assertEqual(video['duration'], 10) self.assertEqual(video['uploader'], 'Philipp Hagemeister') + def test_youtube_channel_no_uploads(self): + dl = FakeYDL() + dl.params['extract_flat'] = True + ie = YoutubeTabIE(dl) + # no uploads + with self.assertRaisesRegex(ExtractorError, r'no uploads'): + ie.extract('https://www.youtube.com/channel/UC2yXPzFejc422buOIzn_0CA') + + # no uploads and no UCID given + with self.assertRaisesRegex(ExtractorError, r'no uploads'): + ie.extract('https://www.youtube.com/news') + if __name__ == '__main__': unittest.main() |