From d34f8f2e401a50f1d90c9e043cc88c4cfdd2217e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Thu, 2 Jan 2014 17:48:59 +0100 Subject: [PATCH] grooveshark: adapt test for logged and non logged users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- modules/grooveshark/test.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/grooveshark/test.py b/modules/grooveshark/test.py index ec9af039..4d604119 100644 --- a/modules/grooveshark/test.py +++ b/modules/grooveshark/test.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with weboob. If not, see . - +from nose.plugins.skip import SkipTest from weboob.tools.test import BackendTest from weboob.capabilities.audio import BaseAudio @@ -29,11 +29,16 @@ class GroovesharkTest(BackendTest): result = list(self.backend.search_audio("Loic Lantoine")) self.assertTrue(len(result) > 0) - def test_grooveshark_user_playlist(self): + def test_grooveshark_user_playlist_not_logged(self): + if self.backend.browser.is_logged(): + raise SkipTest("User credentials defined") + l1 = list(self.backend.iter_resources([BaseAudio], [u'playlists'])) + assert len(l1)==0 + + def test_grooveshark_user_playlist_logged(self): + if not self.backend.browser.is_logged(): + raise SkipTest("User credentials not defined") l1 = list(self.backend.iter_resources([BaseAudio], [u'playlists'])) - if(not self.backend.browser.is_logged()): - assert len(l1)==0 - return assert len(l1) c = l1[0] l2 = list(self.backend.iter_resources([BaseAudio], c.split_path))