test: align dispatch tests with provider-scoped validation and named registration errors

Follow-ups for the salvaged wave: the auto-detect legacy-error test now
stubs the split validators, the unknown-command-provider test expects
the new provider_not_registered error, and _transcribe_local tolerates
a null stt.local config section again.
This commit is contained in:
Teknium 2026-07-28 09:34:46 -07:00
parent ce57e9fa85
commit 0897e0adb8
3 changed files with 7 additions and 2 deletions

View file

@ -528,7 +528,10 @@ class TestTranscribeAudioDispatchToCommandProvider:
with patch("tools.transcription_tools._load_stt_config", return_value=cfg):
result = transcribe_audio(str(audio))
assert result["success"] is False
assert "No STT provider available" in result["error"]
# Explicitly-configured unknown providers now get a named
# registration error instead of the generic legacy message.
assert result["error_type"] == "provider_not_registered"
assert "unknown-cli" in result["error"]
# ---------------------------------------------------------------------------

View file

@ -256,6 +256,8 @@ class TestTranscribeAudioE2E:
from unittest.mock import patch
with patch("tools.transcription_tools._validate_audio_file", return_value=None), \
patch("tools.transcription_tools._validate_audio_source_file", return_value=None), \
patch("tools.transcription_tools._validate_audio_file_size", return_value=None), \
patch("tools.transcription_tools._load_stt_config", return_value={}), \
patch("tools.transcription_tools.is_stt_enabled", return_value=True), \
patch("tools.transcription_tools._get_provider", return_value="none"):

View file

@ -1399,7 +1399,7 @@ def _transcribe_local(file_path: str, model_name: str) -> Dict[str, Any]:
return {"success": False, "transcript": "", "error": "faster-whisper not installed"}
try:
local_cfg = _load_stt_config().get("local", {})
local_cfg = _load_stt_config().get("local") or {}
# Lazy-load the model (downloads on first use, ~150 MB for 'base').
# Double-checked lock: concurrent voice messages must not both
# download/load the model (#24767).