diff options
author | Eddy Pedroni <epedroni@pm.me> | 2025-02-26 18:09:06 +0100 |
---|---|---|
committer | Eddy Pedroni <epedroni@pm.me> | 2025-02-26 18:25:41 +0100 |
commit | 3c065ceded2a58d5aadbcf64417f2cfc92268a08 (patch) | |
tree | 95e965feeb2313dd657c8335c57b16fffefff9a0 /solo-tool-project/test/solo_tool_integrationtest.py | |
parent | 0821b21761a6d47ac1d34c2142365dbaa361b79e (diff) |
Refactor fixtures, introduce song pool argument
Diffstat (limited to 'solo-tool-project/test/solo_tool_integrationtest.py')
-rw-r--r-- | solo-tool-project/test/solo_tool_integrationtest.py | 40 |
1 files changed, 7 insertions, 33 deletions
diff --git a/solo-tool-project/test/solo_tool_integrationtest.py b/solo-tool-project/test/solo_tool_integrationtest.py index f8ed2f1..5d8f14c 100644 --- a/solo-tool-project/test/solo_tool_integrationtest.py +++ b/solo-tool-project/test/solo_tool_integrationtest.py @@ -2,28 +2,7 @@ import pathlib import shutil import pytest -from solo_tool.solo_tool import SoloTool -from player_mock import Player as MockPlayer - -@pytest.fixture -def mockPlayer(): - return MockPlayer() - -@pytest.fixture -def uut(mockPlayer): - return SoloTool(mockPlayer) - -@pytest.fixture -def prepared_tmp_path(tmp_path): - testFiles = [ - "test.flac", - "test.mp3", - "test_session.json" - ] - for f in testFiles: - shutil.copy(pathlib.Path(f), tmp_path) - - return tmp_path +from fixtures import soloTool as uut, songPool, mockPlayer, testSongs def test_playerControls(uut, mockPlayer): assert not mockPlayer.playing @@ -104,9 +83,8 @@ def test_sanitizePlaybackVolume(uut): uut.volume = 150.0 assert uut.volume == 150.0 -def test_playingStateNotification(uut, mockPlayer): - song = "test.flac" - uut.addSong(song) +def test_playingStateNotification(uut, mockPlayer, testSongs): + uut.addSong(testSongs[0]) called = False receivedValue = None @@ -134,10 +112,8 @@ def test_playingStateNotification(uut, mockPlayer): uut.pause() assert not called -def test_playbackVolumeNotification(uut, mockPlayer): - song = "test.flac" - uut.addSong(song) - uut.song = 0 +def test_playbackVolumeNotification(uut, mockPlayer, testSongs): + uut.addSong(testSongs[0]) called = False receivedValue = None @@ -158,10 +134,8 @@ def test_playbackVolumeNotification(uut, mockPlayer): uut.volume = 0.3 assert not called -def test_playbackRateNotification(uut, mockPlayer): - song = "test.flac" - uut.addSong(song) - uut.song = 0 +def test_playbackRateNotification(uut, mockPlayer, testSongs): + uut.addSong(testSongs[0]) called = False receivedValue = None |