From 97b379d29cf5247fb5071591a6809365d633f60b Mon Sep 17 00:00:00 2001 Message-Id: <97b379d29cf5247fb5071591a6809365d633f60b.1714710611.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sun, 3 Aug 2008 18:18:52 +0100 Subject: [PATCH] More playlist testing. Fix sharing status of un-owned playlists. Organization: Straylight/Edgeware From: Richard Kettlewell --- lib/trackdb-playlists.c | 2 +- tests/playlists.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/trackdb-playlists.c b/lib/trackdb-playlists.c index fb01d20..133e8b7 100644 --- a/lib/trackdb-playlists.c +++ b/lib/trackdb-playlists.c @@ -81,7 +81,7 @@ int playlist_parse_name(const char *name, if(!valid_username(name)) return -1; owner = 0; - share = "public"; + share = "shared"; } if(ownerp) *ownerp = owner; diff --git a/tests/playlists.py b/tests/playlists.py index 600991a..11847fb 100755 --- a/tests/playlists.py +++ b/tests/playlists.py @@ -26,9 +26,11 @@ def test(): dtest.create_user() c = disorder.client() c.random_disable() + # print " checking initial playlist set is empty" l = c.playlists() assert l == [], "checking initial playlist set is empty" + # print " creating a shared playlist" c.playlist_lock("wibble") c.playlist_set("wibble", ["one", "two", "three"]) @@ -39,6 +41,26 @@ def test(): print " checking new playlist contents is as assigned" l = c.playlist_get("wibble") assert l == ["one", "two", "three"], "checking playlist contents" + # + print " checking new playlist is shared" + s = c.playlist_get_share("wibble") + assert s == "shared", "checking playlist is shared" + # + print " checking cannot unshare un-owned playlist" + try: + c.playlist_set_share("wibble", "private") + print "*** should not be able to adjust shared playlist's sharing ***" + assert False + except disorder.operationError: + pass # good + # + print " modifying shared playlist" + c.playlist_lock("wibble") + c.playlist_set("wibble", ["three", "two", "one"]) + c.playlist_unlock() + print " checking updated playlist contents is as assigned" + l = c.playlist_get("wibble") + assert l == ["three", "two", "one"], "checking modified playlist contents" if __name__ == '__main__': dtest.run() -- [mdw]