fix: dedupe daily report Telegram in dual mode and show host in summary fallback

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-03 09:15:21 +10:00
parent 3053058cdf
commit 0d4a50cd35
4 changed files with 93 additions and 3 deletions
+21
View File
@@ -210,6 +210,27 @@ def test_lifecycle_footer_uses_telegram_via_agent_when_present():
assert "📡 Оповещение: агент (rdp-login-monitor 1.2.30-SAC)" in text
def test_daily_report_summary_fallback_includes_host():
host = Host(hostname="srv1", display_name="K6A-DC5", ipv4="192.168.160.91", os_family="linux")
event = Event(
event_id="00000000-0000-4000-8000-000000000508",
host_id=1,
host=host,
occurred_at=datetime(2026, 6, 3, 9, 0, tzinfo=timezone.utc),
category="report",
type="report.daily.ssh",
severity="info",
title="Ежедневный отчёт SSH",
summary="SSH 24ч: успех 0, неудач 0, банов 0",
details={"generated_by": "sac"},
payload={},
)
text = format_event_telegram_html(event)
assert "K6A-DC5" in text
assert "SSH 24ч: успех 0" in text
assert "ЕЖЕДНЕВНЫЙ ОТЧЕТ SSH" in text
def test_rdp_shadow_control_template():
host = Host(hostname="RDS01", display_name="RDS Farm", ipv4="10.0.0.5", os_family="windows")
event = Event(