Move tests to the IE definitions
[youtube-dl] / youtube_dl / extractor / justintv.py
index 9c46baed56d27fbb6229db266ea6bc64555254b0..f6001799231f6361608643e0b2a27667913c882e 100644 (file)
@@ -26,6 +26,17 @@ class JustinTVIE(InfoExtractor):
         """
     _JUSTIN_PAGE_LIMIT = 100
     IE_NAME = u'justin.tv'
+    _TEST = {
+        u'url': u'http://www.twitch.tv/thegamedevhub/b/296128360',
+        u'file': u'296128360.flv',
+        u'md5': u'ecaa8a790c22a40770901460af191c9a',
+        u'info_dict': {
+            u"upload_date": u"20110927", 
+            u"uploader_id": 25114803, 
+            u"uploader": u"thegamedevhub", 
+            u"title": u"Beginner Series - Scripting With Python Pt.1"
+        }
+    }
 
     def report_download_page(self, channel, offset):
         """Report attempt to download a single page of videos."""
@@ -34,11 +45,11 @@ class JustinTVIE(InfoExtractor):
 
     # Return count of items, list of *valid* items
     def _parse_page(self, url, video_id):
-        webpage = self._download_webpage(url, video_id,
-                                         u'Downloading video info JSON',
-                                         u'unable to download video info JSON')
+        info_json = self._download_webpage(url, video_id,
+                                           u'Downloading video info JSON',
+                                           u'unable to download video info JSON')
 
-        response = json.loads(webpage)
+        response = json.loads(info_json)
         if type(response) != list:
             error_text = response.get('error', 'unknown error')
             raise ExtractorError(u'Justin.tv API: %s' % error_text)