Files
Nexus/tests/test_batch_server_display_name.py
T
Nexus Agent 0f6f91e61a fix(api): align alerts/commands contracts and ship full-site test suite.
Restore alert history filters and stats fields, paginate command/session logs for the SPA, show script labels on schedules, and land integration/E2E coverage with rebuilt web assets.
2026-06-09 02:13:13 +08:00

19 lines
692 B
Python

"""Batch agent result server name resolution."""
from server.application.server_batch_common import batch_server_display_name as _batch_server_display_name
from server.domain.models import Server
def test_batch_display_name_prefers_name():
s = Server(id=164, name="武汉高琼棠商务科技有限公司", domain="1.2.3.4")
assert _batch_server_display_name(s) == "武汉高琼棠商务科技有限公司"
def test_batch_display_name_falls_back_to_domain():
s = Server(id=59, name="", domain="whgqt.com")
assert _batch_server_display_name(s) == "whgqt.com"
def test_batch_display_name_missing_server():
assert _batch_server_display_name(None) == "未知服务器"