async def test_playlist_fm_mode_play_previous(app_mock, song, song1, mocker): pl = Playlist(app_mock) pl.mode = PlaylistMode.fm pl.fm_add(song1) pl.fm_add(song) pl._current_song = song pl.current_song = song1 # should not exit fm mode assert pl.mode is PlaylistMode.fm
async def test_playlist_fm_mode_play_next(app_mock, song, song1, mocker): mocker.patch.object(Playlist, 'a_set_current_song') pl = Playlist(app_mock) pl.mode = PlaylistMode.fm pl.fm_add(song1) pl.fm_add(song) pl._current_song = song1 pl.current_song = song # should not exit fm mode assert pl.mode is PlaylistMode.fm
async def test_playlist_fm_mode_play_next(app_mock, song, song1, mock_a_set_cursong): pl = Playlist(app_mock) pl.mode = PlaylistMode.fm pl.fm_add(song1) pl.fm_add(song) pl._current_song = song1 pl.current_song = song # should not exit fm mode assert pl.mode is PlaylistMode.fm
async def test_playlist_eof_reached(app_mock, song, mocker): mock_emit = mocker.patch.object(Signal, 'emit') pl = Playlist(app_mock) pl.mode = PlaylistMode.fm pl.next() # first emit pl.fm_add(song) # assume current_song is song pl._current_song = song pl.next() # second emit mock_emit.assert_has_calls([ mock.call(), mock.call(), ])
async def test_playlist_eof_reached(app_mock, song, mocker, mock_a_set_cursong): mock_emit = mocker.patch.object(Signal, 'emit') pl = Playlist(app_mock) pl.mode = PlaylistMode.fm pl.next() # first emit pl.fm_add(song) # assume current_song is song pl._current_song = song pl.next() # second emit mock_emit.assert_has_calls([ mock.call(PlaybackMode.sequential), mock.call(PlaylistMode.fm), mock.call(), mock.call(0, 1), # songs_added mock.call() ])