From cda8197669409689be291660f93cb288ab2d31b3 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Sat, 9 Nov 2024 20:35:56 +0100 Subject: Migrate to project-based structure --- cli-project/test/solo_tool_cli_integrationtest.py | 41 +++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 cli-project/test/solo_tool_cli_integrationtest.py (limited to 'cli-project/test/solo_tool_cli_integrationtest.py') 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 + -- cgit v1.2.3