From 7891e92a7fd084e8ccb20a44162807666b94d5bf Mon Sep 17 00:00:00 2001 From: "Mike Bailey (aider)" Date: Wed, 18 Dec 2024 03:01:30 +1100 Subject: [PATCH] feat: Add support for custom Whisper API endpoints with robust key handling --- tests/basic/test_voice.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/basic/test_voice.py b/tests/basic/test_voice.py index 97ae0455903..99887a03cab 100644 --- a/tests/basic/test_voice.py +++ b/tests/basic/test_voice.py @@ -111,12 +111,13 @@ def test_record_and_transcribe_no_api_key(): def test_record_and_transcribe_custom_base_no_key(): with patch("aider.voice.sf", MagicMock()): - voice = Voice() - with patch.dict(os.environ, {"WHISPER_API_BASE": "http://custom.api"}, clear=True): - with pytest.raises(Exception) as exc: - voice.record_and_transcribe() - assert "When using a custom WHISPER_API_BASE" in str(exc.value) - assert "via --api whisper=" in str(exc.value) + with patch("aider.voice.Voice.raw_record_and_transcribe") as mock_record: + voice = Voice() + with patch.dict(os.environ, {"WHISPER_API_BASE": "http://custom.api"}, clear=True): + with pytest.raises(Exception) as exc: + voice.record_and_transcribe() + assert "When using a custom WHISPER_API_BASE" in str(exc.value) + assert "via --api whisper=" in str(exc.value) def test_record_and_transcribe_custom_base_with_key(): with patch("aider.voice.sf", MagicMock()):