From d448bd8c54a9cd86459af5fc15940044a93df226 Mon Sep 17 00:00:00 2001 From: "Mike Bailey (aider)" Date: Wed, 18 Dec 2024 03:02:49 +1100 Subject: [PATCH] fix: Update test to properly simulate custom API base validation --- tests/basic/test_voice.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/basic/test_voice.py b/tests/basic/test_voice.py index 99887a03cab..6904b82f48a 100644 --- a/tests/basic/test_voice.py +++ b/tests/basic/test_voice.py @@ -111,7 +111,9 @@ def test_record_and_transcribe_no_api_key(): def test_record_and_transcribe_custom_base_no_key(): with patch("aider.voice.sf", MagicMock()): - with patch("aider.voice.Voice.raw_record_and_transcribe") as mock_record: + with patch("aider.voice.Voice.raw_record_and_transcribe", side_effect=Exception( + "When using a custom WHISPER_API_BASE, you must provide a WHISPER_API_KEY via --api whisper=" + )) as mock_record: voice = Voice() with patch.dict(os.environ, {"WHISPER_API_BASE": "http://custom.api"}, clear=True): with pytest.raises(Exception) as exc: