Add additional persistence tests for playlists
This commit is contained in:
parent
67ea51e719
commit
658925dfc1
@ -118,8 +118,14 @@ class GStreamerStoredPlaylistsController(BaseStoredPlaylistsController):
|
||||
return playlist
|
||||
|
||||
def delete(self, playlist):
|
||||
if playlist in self._playlists:
|
||||
self._playlists.remove(playlist)
|
||||
if playlist not in self._playlists:
|
||||
return
|
||||
|
||||
self._playlists.remove(playlist)
|
||||
file = os.path.join(self._folder, playlist.name + '.m3u')
|
||||
|
||||
if os.path.exists(file):
|
||||
os.remove(file)
|
||||
|
||||
def rename(self, playlist, name):
|
||||
if playlist not in self._playlists:
|
||||
|
||||
@ -57,8 +57,19 @@ class GStreamerBackendStoredPlaylistsControllerTest(BaseStoredPlaylistsControlle
|
||||
|
||||
def test_created_playlist_is_persisted(self):
|
||||
self.stored.create('test')
|
||||
playlist = os.path.join(settings.PLAYLIST_FOLDER, 'test.m3u')
|
||||
self.assert_(os.path.exists(playlist))
|
||||
file= os.path.join(settings.PLAYLIST_FOLDER, 'test.m3u')
|
||||
self.assert_(os.path.exists(file))
|
||||
|
||||
def test_saved_playlist_is_persisted(self):
|
||||
self.stored.save(Playlist(name='test2'))
|
||||
file= os.path.join(settings.PLAYLIST_FOLDER, 'test2.m3u')
|
||||
self.assert_(os.path.exists(file))
|
||||
|
||||
def test_deleted_playlist_get_removed(self):
|
||||
playlist = self.stored.create('test')
|
||||
self.stored.delete(playlist)
|
||||
file= os.path.join(settings.PLAYLIST_FOLDER, 'test.m3u')
|
||||
self.assert_(not os.path.exists(file))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Loading…
Reference in New Issue
Block a user