nficano commited on
Commit
518759a
·
1 Parent(s): 2494cbf

added does not exist test

Browse files
Files changed (1) hide show
  1. tests/test_pytube.py +13 -13
tests/test_pytube.py CHANGED
@@ -25,19 +25,6 @@ class TestPytube(object):
25
  self.yt._js_cache = self.mock_js
26
  self.yt.from_url(url)
27
 
28
- @raises(AgeRestricted)
29
- def test_age_restricted_video(self):
30
- """Raise exception on age restricted video"""
31
- url = 'http://www.youtube.com/watch?v=nzNgkc6t260'
32
-
33
- with open('tests/mock_data/youtube_age_restricted.html') as fh:
34
- mock_html = fh.read()
35
-
36
- with mock.patch('pytube.api.urlopen') as urlopen:
37
- urlopen.return_value.read.return_value = mock_html
38
- yt = api.YouTube()
39
- yt.from_url(url)
40
-
41
  def test_get_video_id(self):
42
  """Resolve the video id from url"""
43
  eq_(self.yt.video_id, '9bZkp7q19f0')
@@ -94,3 +81,16 @@ class TestPytube(object):
94
  def test_get_does_not_exist(self):
95
  """get(...) must return something"""
96
  self.yt.get('mp4', '1080p')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  self.yt._js_cache = self.mock_js
26
  self.yt.from_url(url)
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  def test_get_video_id(self):
29
  """Resolve the video id from url"""
30
  eq_(self.yt.video_id, '9bZkp7q19f0')
 
81
  def test_get_does_not_exist(self):
82
  """get(...) must return something"""
83
  self.yt.get('mp4', '1080p')
84
+
85
+ @raises(AgeRestricted)
86
+ def test_age_restricted_video(self):
87
+ """Raise exception on age restricted video"""
88
+ url = 'http://www.youtube.com/watch?v=nzNgkc6t260'
89
+
90
+ with open('tests/mock_data/youtube_age_restricted.html') as fh:
91
+ mock_html = fh.read()
92
+
93
+ with mock.patch('pytube.api.urlopen') as urlopen:
94
+ urlopen.return_value.read.return_value = mock_html
95
+ yt = api.YouTube()
96
+ yt.from_url(url)