fix tests

This commit is contained in:
Mort Yao 2014-07-21 03:17:30 +02:00
parent 13d40fa694
commit 7f2f203510
4 changed files with 18 additions and 34 deletions

View File

@ -1,47 +1,31 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest import unittest
from you_get import * from you_get import *
from you_get.extractor.__main__ import url_to_module from you_get.extractors import *
from you_get.common import *
def test_urls(urls):
for url in urls:
url_to_module(url)[0].download(url, info_only = True)
class YouGetTests(unittest.TestCase): class YouGetTests(unittest.TestCase):
def test_freesound(self): def test_freesound(self):
test_urls([ freesound.download("http://www.freesound.org/people/Corsica_S/sounds/184419/", info_only=True)
"http://www.freesound.org/people/Corsica_S/sounds/184419/",
])
def test_magisto(self): def test_magisto(self):
test_urls([ magisto.download("http://www.magisto.com/album/video/f3x9AAQORAkfDnIFDA", info_only=True)
"http://www.magisto.com/album/video/f3x9AAQORAkfDnIFDA",
])
def test_mixcloud(self): def test_mixcloud(self):
test_urls([ mixcloud.download("http://www.mixcloud.com/beatbopz/beat-bopz-disco-mix/", info_only=True)
"http://www.mixcloud.com/beatbopz/beat-bopz-disco-mix/", mixcloud.download("http://www.mixcloud.com/DJVadim/north-america-are-you-ready/", info_only=True)
"http://www.mixcloud.com/DJVadim/north-america-are-you-ready/",
])
def test_ted(self): def test_ted(self):
test_urls([ ted.download("http://www.ted.com/talks/jennifer_lin_improvs_piano_magic.html", info_only=True)
"http://www.ted.com/talks/jennifer_lin_improvs_piano_magic.html", ted.download("http://www.ted.com/talks/derek_paravicini_and_adam_ockelford_in_the_key_of_genius.html", info_only=True)
"http://www.ted.com/talks/derek_paravicini_and_adam_ockelford_in_the_key_of_genius.html",
])
def test_vimeo(self): def test_vimeo(self):
test_urls([ vimeo.download("http://vimeo.com/56810854", info_only=True)
"http://vimeo.com/56810854",
])
def test_youtube(self): def test_youtube(self):
test_urls([ youtube.download("http://www.youtube.com/watch?v=pzKerr0JIPA", info_only=True)
"http://www.youtube.com/watch?v=pzKerr0JIPA", youtube.download("http://youtu.be/pzKerr0JIPA", info_only=True)
"http://youtu.be/pzKerr0JIPA", youtube.download("http://www.youtube.com/attribution_link?u=/watch?v%3DldAKIzq7bvs%26feature%3Dshare", info_only=True)
"http://www.youtube.com/attribution_link?u=/watch?v%3DldAKIzq7bvs%26feature%3Dshare"
])

View File

@ -2,7 +2,7 @@
import unittest import unittest
from you_get import * from you_get.common import *
class TestCommon(unittest.TestCase): class TestCommon(unittest.TestCase):

View File

@ -2,7 +2,7 @@
import unittest import unittest
from you_get.util import * from you_get.util.fs import *
class TestUtil(unittest.TestCase): class TestUtil(unittest.TestCase):
def test_legitimize(self): def test_legitimize(self):