hbmartin commited on
Commit
0bdab6b
·
1 Parent(s): cf1c020

added cli test

Browse files
tests/contrib/test_playlist.py CHANGED
@@ -88,7 +88,7 @@ def test_video_urls(request_get, playlist_html):
88
 
89
  @mock.patch("pytube.contrib.playlist.request.get")
90
  @mock.patch("pytube.cli.YouTube.__init__", return_value=None)
91
- def test_video_urls(youtube, request_get, playlist_html):
92
  url = "https://www.fakeurl.com/playlist?list=whatever"
93
  request_get.return_value = playlist_html
94
  playlist = Playlist(url)
 
88
 
89
  @mock.patch("pytube.contrib.playlist.request.get")
90
  @mock.patch("pytube.cli.YouTube.__init__", return_value=None)
91
+ def test_videos(youtube, request_get, playlist_html):
92
  url = "https://www.fakeurl.com/playlist?list=whatever"
93
  request_get.return_value = playlist_html
94
  playlist = Playlist(url)
tests/test_cli.py CHANGED
@@ -177,3 +177,13 @@ def test_download_by_resolution(youtube):
177
  cli.main()
178
  youtube.assert_called()
179
  cli.download_by_resolution.assert_called()
 
 
 
 
 
 
 
 
 
 
 
177
  cli.main()
178
  youtube.assert_called()
179
  cli.download_by_resolution.assert_called()
180
+
181
+
182
+ @mock.patch("pytube.cli.Playlist")
183
+ def test_download_by_resolution(playlist):
184
+ parser = argparse.ArgumentParser()
185
+ args = parse_args(parser, ["https://www.youtube.com/playlist?list=PLyn", "-r", "320p"])
186
+ cli._parse_args = MagicMock(return_value=args)
187
+ cli.download_by_resolution = MagicMock()
188
+ cli.main()
189
+ playlist.assert_called()