From 6eb42e6d4468ad161281125c77a41063f93380e1 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Tue, 21 Dec 2021 18:24:55 +0100 Subject: Added session manager, renamed solo-tool.py --- playlist_unittest.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'playlist_unittest.py') diff --git a/playlist_unittest.py b/playlist_unittest.py index b407e4d..ff5a79c 100644 --- a/playlist_unittest.py +++ b/playlist_unittest.py @@ -13,7 +13,8 @@ def test_addAndSelectOneSong(): uut.setCurrentSong(0) assert songAddedByUser == songSetByCallback - assert uut.getCurrentSong() == 0 + assert uut.getCurrentSong() == songAddedByUser + assert uut.getSongs() == [songAddedByUser] def test_addTwoSongsAndSelectBoth(): songAddedByUser = ["/path/to/song", "/path/to/second/song"] @@ -26,16 +27,17 @@ def test_addTwoSongsAndSelectBoth(): uut = Playlist(testCallback) uut.addSong(songAddedByUser[0]) uut.addSong(songAddedByUser[1]) + assert uut.getSongs() == songAddedByUser uut.setCurrentSong(0) assert songAddedByUser[0] == songSetByCallback - assert uut.getCurrentSong() == 0 + assert uut.getCurrentSong() == songAddedByUser[0] uut.setCurrentSong(1) assert songAddedByUser[1] == songSetByCallback - assert uut.getCurrentSong() == 1 + assert uut.getCurrentSong() == songAddedByUser[1] -def test_firstAddedSongIsSelected(): +def test_firstAddedSongIsNotSelected(): songAddedByUser = "/path/to/song" songSetByCallback = None @@ -46,8 +48,9 @@ def test_firstAddedSongIsSelected(): uut = Playlist(testCallback) uut.addSong(songAddedByUser) - assert songAddedByUser == songSetByCallback - assert uut.getCurrentSong() == 0 + assert songSetByCallback == None + assert uut.getCurrentSong() == None + assert uut.getSongs() == [songAddedByUser] def test_invalidSongSelection(): songAddedByUser = "/path/to/song" @@ -59,6 +62,7 @@ def test_invalidSongSelection(): uut = Playlist(testCallback) assert songSetByCallback == None + assert uut.getCurrentSong() == None uut.setCurrentSong(10) assert songSetByCallback == None @@ -66,6 +70,7 @@ def test_invalidSongSelection(): uut.addSong(songAddedByUser) uut.setCurrentSong(10) - assert songSetByCallback == songAddedByUser - assert uut.getCurrentSong() == 0 + assert songSetByCallback == None + assert uut.getCurrentSong() == None + assert uut.getSongs() == [songAddedByUser] -- cgit v1.2.3