Files
Nexus/tests/test_watch_probe_errors.py
T
2026-07-08 22:31:31 +08:00

24 lines
748 B
Python

"""Tests for watch probe error localization."""
from server.utils.watch_probe_errors import watch_probe_error_zh
def test_parse_error_zh():
assert watch_probe_error_zh("parse_error") == "探针返回数据无法解析"
assert watch_probe_error_zh("psutil missing") == "子机未安装 psutil"
def test_parse_error_with_detail():
out = watch_probe_error_zh("parse_error: psutil missing")
assert "探针返回数据无法解析" in out
assert "psutil" in out
def test_timeout_zh():
out = watch_probe_error_zh("Connection timed out during banner exchange")
assert out.startswith("SSH 连接超时")
def test_status_only_fallback():
assert watch_probe_error_zh(None, status="ssh_timeout") == "SSH 连接超时"