[vimeo] fix #1692 there is no latest category on vimeo.

allow to browse categories and channels
This commit is contained in:
Bezleputh 2014-12-18 15:59:52 +01:00 committed by Florent
commit c31e95403e
4 changed files with 96 additions and 19 deletions

View file

@ -18,6 +18,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.capabilities.video import BaseVideo
from weboob.tools.test import BackendTest
import itertools
@ -32,9 +33,20 @@ class VimeoTest(BackendTest):
self.backend.fillobj(v, ('url',))
self.assertTrue(v.url and v.url.startswith('http://'), 'URL for video "%s" not found: %s' % (v.id, v.url))
# def test_latest(self):
# l = list(self.backend.iter_resources([BaseVideo], [u'latest']))
# self.assertTrue(len(l) > 0)
# v = l[0]
# self.backend.fillobj(v, ('url',))
# self.assertTrue(v.url and v.url.startswith('http://'), 'URL for video "%s" not found: %s' % (v.id, v.url))
def test_channels(self):
l = list(itertools.islice(self.backend.iter_resources([BaseVideo], [u'vimeo-channels']), 0, 20))
self.assertTrue(len(l) > 0)
l1 = list(itertools.islice(self.backend.iter_resources([BaseVideo], l[0].split_path), 0, 20))
self.assertTrue(len(l1) > 0)
v = l1[0]
self.backend.fillobj(v, ('url',))
self.assertTrue(v.url and v.url.startswith('http://'), 'URL for video "%s" not found: %s' % (v.id, v.url))
def test_categories(self):
l = list(itertools.islice(self.backend.iter_resources([BaseVideo], [u'vimeo-categories']), 0, 20))
self.assertTrue(len(l) > 0)
l1 = list(itertools.islice(self.backend.iter_resources([BaseVideo], l[0].split_path), 0, 20))
self.assertTrue(len(l1) > 0)
v = l1[0]
self.backend.fillobj(v, ('url',))
self.assertTrue(v.url and v.url.startswith('http://'), 'URL for video "%s" not found: %s' % (v.id, v.url))