test: fix microphone interactive test
This was created with the assumption that all devices were choosable, but now only ones with input channels are. ref: N25B-119
This commit is contained in:
@@ -41,6 +41,9 @@ class MicrophoneUtils(object):
|
||||
"""
|
||||
First mock an input that's not an integer, then a valid integer. There should be no errors.
|
||||
"""
|
||||
microphones = get_microphones(pyaudio_instance)
|
||||
target_microphone = next(microphones)
|
||||
|
||||
mock_input = mocker.patch("__builtin__.raw_input", side_effect=["not an integer", "0"])
|
||||
fake_out = StringIO()
|
||||
mocker.patch.object(sys, "stdout", fake_out)
|
||||
@@ -48,7 +51,7 @@ class MicrophoneUtils(object):
|
||||
result = choose_mic_interactive(pyaudio_instance)
|
||||
assert "index" in result
|
||||
assert isinstance(result["index"], (int, long))
|
||||
assert result["index"] == 0
|
||||
assert result["index"] == target_microphone["index"]
|
||||
|
||||
assert mock_input.called
|
||||
|
||||
@@ -58,6 +61,9 @@ class MicrophoneUtils(object):
|
||||
"""
|
||||
Make sure that the interactive method does not allow negative integers as input.
|
||||
"""
|
||||
microphones = get_microphones(pyaudio_instance)
|
||||
target_microphone = next(microphones)
|
||||
|
||||
mock_input = mocker.patch("__builtin__.raw_input", side_effect=["-1", "0"])
|
||||
fake_out = StringIO()
|
||||
mocker.patch.object(sys, "stdout", fake_out)
|
||||
@@ -65,7 +71,7 @@ class MicrophoneUtils(object):
|
||||
result = choose_mic_interactive(pyaudio_instance)
|
||||
assert "index" in result
|
||||
assert isinstance(result["index"], (int, long))
|
||||
assert result["index"] == 0
|
||||
assert result["index"] == target_microphone["index"]
|
||||
|
||||
assert mock_input.called
|
||||
|
||||
|
||||
Reference in New Issue
Block a user