-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* don't depend on nose * don't actually scrape the Video
- Loading branch information
1 parent
0bd0821
commit ced9966
Showing
1 changed file
with
8 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,35 +24,32 @@ | |
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
import unittest | ||
import json | ||
|
||
from nose.tools import eq_ | ||
|
||
from vidscraper import auto_scrape | ||
from vidscraper.compat import json | ||
from vidscraper.suites.base import Video | ||
from vidscraper.videos import Video | ||
|
||
|
||
class VideoTestCase(unittest.TestCase): | ||
def test_items(self): | ||
video = auto_scrape("http://www.youtube.com/watch?v=J_DV9b0x7v4") | ||
video = Video("http://www.youtube.com/watch?v=J_DV9b0x7v4") | ||
|
||
# Make sure items can be iterated over and that there's one | ||
# for every field. | ||
for i, item in enumerate(video.items()): | ||
eq_(item[0], Video._all_fields[i]) | ||
self.assertEqual(item[0], Video._all_fields[i]) | ||
|
||
def test_items_with_fields(self): | ||
fields = ['title', 'user'] | ||
video = auto_scrape("http://www.youtube.com/watch?v=J_DV9b0x7v4", | ||
fields) | ||
video = Video("http://www.youtube.com/watch?v=J_DV9b0x7v4", | ||
fields=fields) | ||
|
||
# Make sure items can be iterated over and that there's one | ||
# for every field. | ||
for i, item in enumerate(video.items()): | ||
eq_(item[0], fields[i]) | ||
self.assertEqual(item[0], fields[i]) | ||
|
||
def test_to_json(self): | ||
video = auto_scrape("http://www.youtube.com/watch?v=J_DV9b0x7v4") | ||
video = Video("http://www.youtube.com/watch?v=J_DV9b0x7v4") | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
paulswartz
Author
Contributor
|
||
|
||
data_json = video.to_json() | ||
# Verify that we can load the json back into Python. | ||
|
You can't do this one. You need real data in order to make sure it jsonifies correctly.