nficano commited on
Commit
1e9e88c
·
1 Parent(s): a2b56cd
Files changed (3) hide show
  1. README.rst +1 -1
  2. pytube/cli.py +3 -4
  3. tests/test_cli.py +13 -0
README.rst CHANGED
@@ -14,7 +14,7 @@ pytube
14
  :alt: Documentation Status
15
  :target: http://python-pytube.readthedocs.io/en/latest/?badge=latest
16
 
17
- .. image:: https://coveralls.io/repos/github/nficano/pytube/badge.svg?branch=master#23e6f7ac5623e
18
  :alt: Code Coverage
19
  :target: https://coveralls.io/github/nficano/pytube?branch=master
20
 
 
14
  :alt: Documentation Status
15
  :target: http://python-pytube.readthedocs.io/en/latest/?badge=latest
16
 
17
+ .. image:: https://coveralls.io/repos/github/nficano/pytube/badge.svg?branch=master#23e6f7ac56dd3e
18
  :alt: Code Coverage
19
  :target: https://coveralls.io/github/nficano/pytube?branch=master
20
 
pytube/cli.py CHANGED
@@ -12,7 +12,6 @@ import os
12
  import sys
13
 
14
  from pytube import __version__
15
- from pytube import request
16
  from pytube import YouTube
17
 
18
 
@@ -78,9 +77,9 @@ def build_playback_report(url):
78
  'yt-video-{yt.video_id}-{ts}.json.tar.gz'.format(yt=yt, ts=ts),
79
  )
80
 
81
- js = request.get(yt.js_url)
82
- watch_html = request.get(yt.watch_html)
83
- vid_info = request.get(yt.vid_info_url)
84
 
85
  with gzip.open(fp, 'wb') as fh:
86
  fh.write(
 
12
  import sys
13
 
14
  from pytube import __version__
 
15
  from pytube import YouTube
16
 
17
 
 
77
  'yt-video-{yt.video_id}-{ts}.json.tar.gz'.format(yt=yt, ts=ts),
78
  )
79
 
80
+ js = yt.js
81
+ watch_html = yt.watch_html
82
+ vid_info = yt.vid_info
83
 
84
  with gzip.open(fp, 'wb') as fh:
85
  fh.write(
tests/test_cli.py CHANGED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ import mock
3
+
4
+ from pytube import cli
5
+
6
+
7
+ @mock.patch('pytube.cli.YouTube')
8
+ @mock.patch('pytube.cli.sys')
9
+ def test_download(MockYouTube, mock_sys):
10
+ instance = MockYouTube.return_value
11
+ instance.prefetch_init.return_value = None
12
+ instance.streams = mock.Mock()
13
+ cli.download('asdf', 'asdf')