From 98e19e803bb4241be6b70e43603c9dc508811a3f Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Sat, 5 Dec 2015 12:48:14 +0100 Subject: [PATCH] mpd: Deleting unkown playlist should return not found --- mopidy/mpd/protocol/stored_playlists.py | 2 ++ tests/mpd/protocol/test_stored_playlists.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/mopidy/mpd/protocol/stored_playlists.py b/mopidy/mpd/protocol/stored_playlists.py index 647a1464..1a24608c 100644 --- a/mopidy/mpd/protocol/stored_playlists.py +++ b/mopidy/mpd/protocol/stored_playlists.py @@ -328,6 +328,8 @@ def rm(context, name): Removes the playlist ``NAME.m3u`` from the playlist directory. """ uri = context.lookup_playlist_uri_from_name(name) + if not uri: + raise exceptions.MpdNoExistError('No such playlist') context.core.playlists.delete(uri).get() diff --git a/tests/mpd/protocol/test_stored_playlists.py b/tests/mpd/protocol/test_stored_playlists.py index e212af09..36635505 100644 --- a/tests/mpd/protocol/test_stored_playlists.py +++ b/tests/mpd/protocol/test_stored_playlists.py @@ -330,6 +330,10 @@ class PlaylistsHandlerTest(protocol.BaseTestCase): self.assertInResponse('OK') self.assertIsNone(self.backend.playlists.lookup('dummy:a1').get()) + def test_rm_unknown_playlist_acks(self): + self.send_request('rm "name"') + self.assertInResponse('ACK [50@0] {rm} No such playlist') + def test_save(self): self.send_request('save "name"')