From 96860fcb9745198dbbee5552438c86a0cb27ca1b Mon Sep 17 00:00:00 2001 From: Laurent Bachelier Date: Tue, 23 Oct 2012 04:26:54 +0200 Subject: [PATCH] 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. --- modules/dailymotion/test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/dailymotion/test.py b/modules/dailymotion/test.py index e069267f..f1f53e3f 100644 --- a/modules/dailymotion/test.py +++ b/modules/dailymotion/test.py @@ -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))