From 182a14f4b9aec4722f7f94ab44bf57356c6d71aa Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Tue, 21 Dec 2021 08:16:55 +0100 Subject: Added AB controller with some tests, minor refactor to playlist --- playlist_unittest.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'playlist_unittest.py') diff --git a/playlist_unittest.py b/playlist_unittest.py index 685dcb0..b407e4d 100644 --- a/playlist_unittest.py +++ b/playlist_unittest.py @@ -13,6 +13,7 @@ def test_addAndSelectOneSong(): uut.setCurrentSong(0) assert songAddedByUser == songSetByCallback + assert uut.getCurrentSong() == 0 def test_addTwoSongsAndSelectBoth(): songAddedByUser = ["/path/to/song", "/path/to/second/song"] @@ -28,9 +29,11 @@ def test_addTwoSongsAndSelectBoth(): uut.setCurrentSong(0) assert songAddedByUser[0] == songSetByCallback + assert uut.getCurrentSong() == 0 uut.setCurrentSong(1) assert songAddedByUser[1] == songSetByCallback + assert uut.getCurrentSong() == 1 def test_firstAddedSongIsSelected(): songAddedByUser = "/path/to/song" @@ -44,6 +47,7 @@ def test_firstAddedSongIsSelected(): uut.addSong(songAddedByUser) assert songAddedByUser == songSetByCallback + assert uut.getCurrentSong() == 0 def test_invalidSongSelection(): songAddedByUser = "/path/to/song" @@ -58,8 +62,10 @@ def test_invalidSongSelection(): uut.setCurrentSong(10) assert songSetByCallback == None + assert uut.getCurrentSong() == None uut.addSong(songAddedByUser) uut.setCurrentSong(10) assert songSetByCallback == songAddedByUser + assert uut.getCurrentSong() == 0 -- cgit v1.2.3