aboutsummaryrefslogtreecommitdiffstats
path: root/cli-project/test
diff options
context:
space:
mode:
authorEddy Pedroni <epedroni@pm.me>2024-11-09 20:35:56 +0100
committerEddy Pedroni <epedroni@pm.me>2024-11-09 20:35:56 +0100
commitcda8197669409689be291660f93cb288ab2d31b3 (patch)
tree81db9b0c7c0491e0737cbffb39af6b935c0dfeb8 /cli-project/test
parenta2257a900d4fffd6f94b73f1c48c62370ed1d684 (diff)
Migrate to project-based structure
Diffstat (limited to 'cli-project/test')
-rw-r--r--cli-project/test/solo_tool_cli_integrationtest.py41
-rw-r--r--cli-project/test/test.flacbin0 -> 31743252 bytes
-rw-r--r--cli-project/test/test.mp3bin0 -> 5389533 bytes
-rw-r--r--cli-project/test/test_session.json13
4 files changed, 54 insertions, 0 deletions
diff --git a/cli-project/test/solo_tool_cli_integrationtest.py b/cli-project/test/solo_tool_cli_integrationtest.py
new file mode 100644
index 0000000..c29a223
--- /dev/null
+++ b/cli-project/test/solo_tool_cli_integrationtest.py
@@ -0,0 +1,41 @@
+import pytest
+import io
+from contextlib import redirect_stdout
+
+from solo_tool_cli import SoloToolCLI
+from solo_tool import SoloTool
+
+class MockMidiController:
+ def __init__(self, soloTool):
+ self.connected = False
+
+ def connect(self):
+ self.connected = True
+
+@pytest.fixture
+def soloTool():
+ return SoloTool()
+
+@pytest.fixture
+def mockMidi(soloTool):
+ return MockMidiController(soloTool)
+
+@pytest.fixture
+def uut(soloTool, mockMidi):
+ return SoloToolCLI("test_session.json", soloToolOverride=soloTool, midiOverride=mockMidi, tickEnable=False)
+
+def test_connectMidi(uut, mockMidi):
+ expectedOutput = """\
+Supported device: Novation Launchpad Mini MkII
+Connecting to MIDI device...
+"""
+
+ with io.StringIO() as buf, redirect_stdout(buf):
+ uut.input("midi")
+ assert not mockMidi.connected
+
+ uut.input("midi connect")
+ assert mockMidi.connected
+
+ assert buf.getvalue() == expectedOutput
+
diff --git a/cli-project/test/test.flac b/cli-project/test/test.flac
new file mode 100644
index 0000000..9164735
--- /dev/null
+++ b/cli-project/test/test.flac
Binary files differ
diff --git a/cli-project/test/test.mp3 b/cli-project/test/test.mp3
new file mode 100644
index 0000000..3c353b7
--- /dev/null
+++ b/cli-project/test/test.mp3
Binary files differ
diff --git a/cli-project/test/test_session.json b/cli-project/test/test_session.json
new file mode 100644
index 0000000..f48b792
--- /dev/null
+++ b/cli-project/test/test_session.json
@@ -0,0 +1,13 @@
+[
+ {
+ "path" : "test.flac",
+ "ab_limits" : null
+ },
+ {
+ "path" : "test.mp3",
+ "ab_limits" : [
+ [0.1, 0.2],
+ [0.3, 0.4]
+ ]
+ }
+]