diff options
author | Eddy Pedroni <eddy@0xf7.com> | 2021-12-22 11:50:49 +0100 |
---|---|---|
committer | Eddy Pedroni <eddy@0xf7.com> | 2021-12-22 11:50:49 +0100 |
commit | d2c7f3d44cb791a7db9ed9a11b0fa30d1eee5f0e (patch) | |
tree | 8fb1caa5c79b7d4f5c666d42151e0768e00a4cfc | |
parent | 96a574d317ccbbff3af3f1a20755c3b79f873510 (diff) |
Added integration test, updated diagram
-rw-r--r-- | diagram.drawio | 2 | ||||
-rw-r--r-- | solo_tool.py | 6 | ||||
-rw-r--r-- | solo_tool_integrationtest.py | 11 |
3 files changed, 16 insertions, 3 deletions
diff --git a/diagram.drawio b/diagram.drawio index 4c20f49..6cf9596 100644 --- a/diagram.drawio +++ b/diagram.drawio @@ -1 +1 @@ -<mxfile host="app.diagrams.net" modified="2021-12-21T21:57:36.542Z" agent="5.0 (X11)" etag="EehibL8XqpTgRi5UYwNc" version="16.0.2" type="device"><diagram id="g-wcGVps3MkI6_XAwNEs" name="Page-1">7Vzbe6I4FP9rfLQfEG4+VtuZ6X7tTnft9DIv+0WJyBZJC/HS/vUbJJFLUgYtioz70pKQhOSc8zu3JHbAYLb6GsKX6Q12kN/RFGfVARcdTbNNk/6NK96SChWoelLjhp7D6tKKofeOWKXCaueeg6JcQ4KxT7yXfOUYBwEak1wdDEO8zDebYD//1RfoIqFiOIa+WPvgOWTKalWzl774hjx3yj5ta1byYgZ5Y7aSaAodvMxUgcsOGIQYk+RpthogPyYep0vS78sHbzcTC1FAqnQwrvrqHbo4t8O/3Hu80Dz/6bXLRllAf84WHGEfMyKzeZM3TowQzwMHxeMpHdBfTj2Chi9wHL9dUvbTuimZ+bSk0kcHRtN127jg+jCKWL8NIdaFZ0TGU1aYeL4/oN8PaTnAAR23D33PDWjRRxO6yv4ChcSj3Dln1QTHXxVJwddFm6NVpoqR5ivCM0TCN9qEvTUMxiYuqDpj8DLlugFYm2mG4ZtKyCTN3YydMoM+MH7IeXPzQ30ajvp3lxZ4fjD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4/p3E9Vs7OHUKnyXnILAKeKfl4cJPleJDp3x29tiscxmrc2zThqh49xJE5XG4Ic0etKopzkfMJpBDdGIT0tyU5bh8wL2CcCGaOiwVCPK1BRxVMfgynG8V7oScFGLx79E2HTO2RKQG0YNwdztCwRNy2I71XxvEeSk15gfz47nb0cM48aU+Kh7SuTJs9CKwLpf0tzo2kVzc1xxSd82jJrs2squtUpAfuXzpqq7Ak/0usueiPwYSkB/pyxOc2kBMoMUBZxZTeG9n26vKcoZ0BNz5ODvPtSvCyWTLuO0+XSRcvODtd+4egYD5KXoaiWg+Q2YJz9pLx0NZDvUstBcunyK90+2+2mQTvvoLVHSHQzp0a6atHS7E9qxOQNZcCzwMCt0pY1mGi7sOV10DthUh+34dNKu14B02q+A1aWkDziLIx02uJljpLEZSMqrEwSa1FhPZD3YOpRaDzg2Nym2oM2k5Km4b01a6czHfUHr58CaWOxq3TWlbwa6amqNrkqZcJcr6vCIanV47mAAtL3cW2yTJrL5SJCUVQSyYgX7GEA3fRm/dayc/ybu2bBr1Ltpv0q1WyTY7W7+lUlF16Pa3e3dNoZoF1juPaSOLgq5wxbnXQ3bKOgQQ+3VyXnTCPHIj4BAKNuwZbbJMv6QMXVn5QrXWd2kwou0P+I6R5wd3dljs6x+c/71ev1eHlze778/uhzzXoclkatZGkKYPkl8qTr3iqHfgBDUzbJDGruZImo48WKxE8XmPVxvqtwPc9SRKzUdL2VFtNfJUyUXvrbjuDyPw==</diagram></mxfile>
\ No newline at end of file +<mxfile host="app.diagrams.net" modified="2021-12-22T10:24:41.010Z" agent="5.0 (X11)" etag="M825lpGmu1hB8eQbLjxm" version="16.0.3" type="device" pages="2"><diagram id="g-wcGVps3MkI6_XAwNEs" name="Core">7VzLeto6EH4aluSzJd9YBpK26UlPc0raJt0JLIwbY6W2IKFPXxkkfJHiGGIwLmeFdbEszcw/N0l04GD2/D5Cj9NPxMVBB2jucwdedADQLVtnP0nNktdoRm9d40W+y+vSiqH/G4uOvHbuuzjOdaSEBNR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S4bNp9cQygMmn1arfLrd8lkh+VAjsiM+L7Px4zb2/6DTMp/mzs9NEKj7y+rW8khJTMSgyZwYj1ADzEmbXJbvF65cKm9cZnXpNbi0x+1yCc3V5TI5UlOhGbPgNTEtxY89A7OhEYAmme2GtLDjkPadoXmZkLbrKROaIW0+ZaYsCQc9U1qN7Z8zuz9eqzheI9hTb1wmgnVgxzOlGcHOI8bUS5IrkZb98hQ5bRXJSbdIvq9NH9jPt5bQfG2Zb/psGc3iYe/Dwsbj0ht3vJy0rsvJU2/0czlpmcvJcpJ8605P/9aT9ovhKzj3Kd7F0LSBIceA0cy/jOzdcrL44PMEzTuGjutJnKZDfy1i205NHafj+NW2ukDy4mjZ/UTLNuNQtMVXtM6i1fXSsGjO+5jtQNeznXsRJJt75h5sGUnz74KvRH0FMGAQ3carf8+bGiT+oq/mZLL6ASnXtPqPy1r+Dw==</diagram></mxfile>
\ No newline at end of file diff --git a/solo_tool.py b/solo_tool.py index 53670fb..538d558 100644 --- a/solo_tool.py +++ b/solo_tool.py @@ -1,3 +1,5 @@ +import os + from playlist import Playlist from abcontroller import ABController from session_manager import SessionManager @@ -22,7 +24,8 @@ class SoloTool: self._abController.positionChanged(position) def addSong(self, path): - self._sessionManager.addSong(path) + if os.path.isfile(path): + self._sessionManager.addSong(path) def setSong(self, index): self._playlist.setCurrentSong(index) @@ -44,7 +47,6 @@ class SoloTool: with open(path, "w") as f: self._sessionManager.saveSession(f) - # Playback control def play(self): self._player.play() diff --git a/solo_tool_integrationtest.py b/solo_tool_integrationtest.py index bbc98a8..2ed2449 100644 --- a/solo_tool_integrationtest.py +++ b/solo_tool_integrationtest.py @@ -218,3 +218,14 @@ def test_loadAndSaveSession(tmp_path): savedSession = json.loads(f.read()) assert loadedSession == savedSession + +def test_addInexistentFile(): + song = "not/a/real/file" + + mockPlayer = MockPlayer() + uut = SoloTool(mockPlayer) + + uut.addSong(song) + uut.setSong(0) + + assert mockPlayer.currentSong == None |