From bc1167ba063e6bb12aa39964ad1be048b428a15c Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Sun, 7 Mar 2010 19:27:13 +0100 Subject: [PATCH] Return 'positive' but empty results on 'count' and 'list' --- mopidy/mpd/handler.py | 4 ++-- tests/mpd/handlertest.py | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/mopidy/mpd/handler.py b/mopidy/mpd/handler.py index 7e50359f..d0638889 100644 --- a/mopidy/mpd/handler.py +++ b/mopidy/mpd/handler.py @@ -540,7 +540,7 @@ class MpdHandler(object): Counts the number of songs and their total playtime in the db matching ``TAG`` exactly. """ - raise MpdNotImplemented # TODO + return [('songs', 0), ('playtime', 0)] # TODO @handle_pattern(r'^find "(?P(album|artist|title))" ' r'"(?P[^"]+)"$') @@ -588,7 +588,7 @@ class MpdHandler(object): ``ARTIST`` is an optional parameter when type is ``album``, this specifies to list albums by an artist. """ - raise MpdNotImplemented # TODO + pass # TODO @handle_pattern(r'^listall "(?P[^"]+)"') def _music_db_listall(self, uri): diff --git a/tests/mpd/handlertest.py b/tests/mpd/handlertest.py index 27a57c90..7eee480f 100644 --- a/tests/mpd/handlertest.py +++ b/tests/mpd/handlertest.py @@ -868,7 +868,9 @@ class MusicDatabaseHandlerTest(unittest.TestCase): def test_count(self): result = self.h.handle_request(u'count "tag" "needle"') - self.assert_(u'ACK Not implemented' in result) + self.assert_(u'songs: 0' in result) + self.assert_(u'playtime: 0' in result) + self.assert_(u'OK' in result) def test_find_album(self): result = self.h.handle_request(u'find "album" "what"') @@ -895,7 +897,7 @@ class MusicDatabaseHandlerTest(unittest.TestCase): def test_list_artist(self): result = self.h.handle_request(u'list "artist"') - self.assert_(u'ACK Not implemented' in result) + self.assert_(u'OK' in result) def test_list_artist_with_artist_should_fail(self): try: @@ -906,11 +908,11 @@ class MusicDatabaseHandlerTest(unittest.TestCase): def test_list_album_without_artist(self): result = self.h.handle_request(u'list "album"') - self.assert_(u'ACK Not implemented' in result) + self.assert_(u'OK' in result) def test_list_album_with_artist(self): result = self.h.handle_request(u'list "album" "anartist"') - self.assert_(u'ACK Not implemented' in result) + self.assert_(u'OK' in result) def test_listall(self): result = self.h.handle_request(u'listall "file:///dev/urandom"')