From d3a3ef14c820bb651c34d70be745ecac159d44f1 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Sun, 3 Aug 2008 18:41:08 +0100 Subject: [PATCH] Python bindings report an error if you delete a nonexistent playlist. Organization: Straylight/Edgeware From: Richard Kettlewell --- python/disorder.py.in | 4 +++- tests/playlists.py | 25 ++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/python/disorder.py.in b/python/disorder.py.in index 56395c9..47d7090 100644 --- a/python/disorder.py.in +++ b/python/disorder.py.in @@ -911,7 +911,9 @@ class client: def playlist_delete(self, playlist): """Delete a playlist""" - self._simple("playlist-delete", playlist) + res, details = self._simple("playlist-delete", playlist) + if res == 555: + raise operationError(res, details, "playlist-delete") def playlist_get(self, playlist): """Get the contents of a playlist diff --git a/tests/playlists.py b/tests/playlists.py index fa717c9..0932632 100755 --- a/tests/playlists.py +++ b/tests/playlists.py @@ -122,7 +122,30 @@ def test(): assert False except disorder.operationError: pass # good - + # + print " deleting playlists" + c.playlist_delete("fred.spong") + l = c.playlists() + assert dtest.lists_have_same_contents(l, + ["fred.foo", "wibble"]) + try: + d.playlist_delete("fred.foo") + print "*** should not be to delete fred's playlist ***" + assert False + except disorder.operationError: + pass # good + d.playlist_delete("wibble") + l = c.playlists() + assert l == ["fred.foo"] + c.playlist_delete("fred.foo") + l = c.playlists() + assert l == [] + try: + c.playlist_delete("nonesuch") + print "*** should not be to delete nonexistent playlist ***" + assert False + except disorder.operationError: + pass # good if __name__ == '__main__': dtest.run() -- [mdw]