diff --git a/tests/tools/test_transcription.py b/tests/tools/test_transcription.py index e8e925d5314..d5c3903ff13 100644 --- a/tests/tools/test_transcription.py +++ b/tests/tools/test_transcription.py @@ -217,6 +217,28 @@ class TestTranscribeLocal: assert result["success"] is True assert "initial_prompt" not in mock_model.transcribe.call_args.kwargs + def test_accepts_null_local_config(self, monkeypatch, tmp_path): + monkeypatch.delenv("HERMES_LOCAL_STT_LANGUAGE", raising=False) + audio_file = tmp_path / "test.ogg" + audio_file.write_bytes(b"fake audio") + + mock_info = MagicMock(language="en", duration=2.5) + mock_model = MagicMock() + mock_model.transcribe.return_value = ([], mock_info) + + fake_fw = _fake_faster_whisper_module(mock_model) + with patch("tools.transcription_tools._HAS_FASTER_WHISPER", True), \ + patch("tools.transcription_tools._load_stt_config", return_value={ + "local": None, + }), \ + patch.dict("sys.modules", {"faster_whisper": fake_fw}), \ + patch("tools.transcription_tools._local_model", None): + from tools.transcription_tools import _transcribe_local + result = _transcribe_local(str(audio_file), "base") + + assert result["success"] is True + assert mock_model.transcribe.call_args.kwargs == {"beam_size": 5} + def test_not_installed(self): with patch("tools.transcription_tools._HAS_FASTER_WHISPER", False): from tools.transcription_tools import _transcribe_local