chiark / gitweb /
Python bindings report an error if you delete a nonexistent playlist.
authorRichard Kettlewell <rjk@greenend.org.uk>
Sun, 3 Aug 2008 17:41:08 +0000 (18:41 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sun, 3 Aug 2008 17:41:08 +0000 (18:41 +0100)
python/disorder.py.in
tests/playlists.py

index 56395c99f11837645ebc349ba99e0f91a8242c1c..47d7090337d63f0ce55fc48e0b0f1d6ad831e3b8 100644 (file)
@@ -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
index fa717c96674044ee34bcbc795fab7d6a21ede2f1..09326323cf33b357300e8057cf93e6ff58528681 100755 (executable)
@@ -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()