diff --git a/mopidy/mpd/handler.py b/mopidy/mpd/handler.py index 0c282b65..6141d651 100644 --- a/mopidy/mpd/handler.py +++ b/mopidy/mpd/handler.py @@ -302,7 +302,7 @@ class MpdHandler(object): Clears the current playlist. """ - raise MpdNotImplemented # TODO + self.backend.current_playlist.clear() @handle_pattern(r'^move "(?P\d+)" "(?P\d+)"$') @handle_pattern(r'^move "(?P\d+):(?P\d+)*" "(?P\d+)"$') diff --git a/tests/mpd/handlertest.py b/tests/mpd/handlertest.py index 170b90f1..c919dd5b 100644 --- a/tests/mpd/handlertest.py +++ b/tests/mpd/handlertest.py @@ -529,8 +529,12 @@ class CurrentPlaylistHandlerTest(unittest.TestCase): self.assert_(u'OK' in result) def test_clear(self): + self.b.current_playlist.playlist = Playlist( + tracks=[Track(), Track(), Track(), Track(), Track()]) + self.assertEquals(self.b.current_playlist.playlist.length, 5) result = self.h.handle_request(u'clear') - self.assert_(u'ACK Not implemented' in result) + self.assertEquals(self.b.current_playlist.playlist.length, 0) + self.assert_(u'OK' in result) def test_delete_songpos(self): self.b.current_playlist.playlist = Playlist(