Files
Nexus/tests/test_watch_probe_errors.py
T
Nexus Agent 75efd506f5 feat(watch): 监测槽 SSH 一键安装 psutil
探针报 psutil missing 时显示安装按钮;POST install-psutil 经 SSH pip/apt 安装并审计。
2026-06-12 04:04:48 +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 连接超时"