Skip to content

The agent that grows with you

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

Teknium0897e0adb8d7
diff --git a/tests/tools/test_transcription_command_providers.py b/tests/tools/test_transcription_command_providers.py
index 10d6e9b332a..f496bfe3bfe 100644
--- a/tests/tools/test_transcription_command_providers.py
+++ b/tests/tools/test_transcription_command_providers.py
@@ -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"]
# ---------------------------------------------------------------------------
diff --git a/tests/tools/test_transcription_plugin_dispatch.py b/tests/tools/test_transcription_plugin_dispatch.py
index 7bfd311de1a..fa8b6db4c9f 100644
--- a/tests/tools/test_transcription_plugin_dispatch.py
+++ b/tests/tools/test_transcription_plugin_dispatch.py
@@ -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"):
diff --git a/tools/transcription_tools.py b/tools/transcription_tools.py
index f9e14e64a65..78b757bf497 100644
--- a/tools/transcription_tools.py
+++ b/tools/transcription_tools.py
@@ -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).