| 123456789101112131415161718192021222324252627282930313233 |
- """Tests for the stt-ctl command mapping."""
- import pytest
- from stt_daemon.ctl import build_message
- @pytest.mark.parametrize(
- ("verb", "expected"),
- [
- ("command-start", "command_start"),
- ("command-execute", "command_execute"),
- ("command-cancel", "command_cancel"),
- ("command-edit", "command_edit"),
- ("chat-toggle", "chat_toggle"),
- ("status", "status"),
- ],
- )
- def test_build_message_maps_verbs(verb, expected):
- assert build_message(verb) == {"type": expected}
- def test_build_message_includes_text_only_when_given():
- assert build_message("command-edit", "hello") == {
- "type": "command_edit",
- "text": "hello",
- }
- assert "text" not in build_message("command-start")
- def test_build_message_rejects_unknown():
- with pytest.raises(ValueError):
- build_message("nope")
|