dailymotion: Chose a random video to test

Did this mostly because the first video had an issue, it was first
in the search results but deleted (the page was "410 Gone").
But this ends up testing more videos anyway.
This commit is contained in:
Laurent Bachelier 2012-10-23 04:26:54 +02:00
commit 96860fcb97

View file

@ -21,6 +21,8 @@
from weboob.tools.test import BackendTest
from weboob.capabilities.video import BaseVideo
from random import choice
class DailymotionTest(BackendTest):
BACKEND = 'dailymotion'
@ -28,7 +30,7 @@ class DailymotionTest(BackendTest):
def test_search(self):
l = list(self.backend.search_videos('chirac'))
self.assertTrue(len(l) > 0)
v = l[0]
v = choice(l)
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))
self.backend.browser.openurl(v.url)
@ -36,6 +38,6 @@ class DailymotionTest(BackendTest):
def test_latest(self):
l = list(self.backend.iter_resources([BaseVideo], [u'latest']))
assert len(l)
v = l[0]
v = choice(l)
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))