mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-26 01:01:40 +00:00
fix(terminal): guard invalid command values
This commit is contained in:
parent
e7d3e9d767
commit
e94008c404
2 changed files with 52 additions and 4 deletions
21
tests/tools/test_terminal_none_command_guard.py
Normal file
21
tests/tools/test_terminal_none_command_guard.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"""Regression tests for invalid/None terminal command handling."""
|
||||
|
||||
import json
|
||||
|
||||
from tools.terminal_tool import _transform_sudo_command, terminal_tool
|
||||
|
||||
|
||||
def test_transform_sudo_command_none_returns_cleanly():
|
||||
transformed, sudo_stdin = _transform_sudo_command(None)
|
||||
|
||||
assert transformed is None
|
||||
assert sudo_stdin is None
|
||||
|
||||
|
||||
def test_terminal_tool_none_command_returns_clean_error():
|
||||
result = json.loads(terminal_tool(None)) # type: ignore[arg-type]
|
||||
|
||||
assert result["exit_code"] == -1
|
||||
assert result["status"] == "error"
|
||||
assert "expected string" in result["error"].lower()
|
||||
assert "nonetype" in result["error"].lower()
|
||||
Loading…
Add table
Add a link
Reference in a new issue