feat: render full agent lifecycle text from notification_body in Telegram
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -110,6 +110,29 @@ def test_lifecycle_started_template():
|
||||
assert "📡 Оповещение: SAC (Security Alert Center)" in text
|
||||
|
||||
|
||||
def test_lifecycle_notification_body_renders_full_text():
|
||||
host = Host(hostname="WIN01", display_name="K6A-DC3", os_family="windows")
|
||||
body = "✅ Мониторинг логинов ЗАПУЩЕН\n🖥️ Сервер: K6A-DC3 (10.0.0.1)\n🕐 Время запуска: 28.05.2026 12:00:00"
|
||||
event = Event(
|
||||
event_id="00000000-0000-4000-8000-000000000507",
|
||||
host_id=1,
|
||||
host=host,
|
||||
occurred_at=datetime(2026, 5, 29, 9, 0, tzinfo=timezone.utc),
|
||||
category="agent",
|
||||
type="agent.lifecycle",
|
||||
severity="info",
|
||||
title="started",
|
||||
summary="Мониторинг запущен",
|
||||
details={"lifecycle": "started", "trigger": "boot", "notification_body": body, "telegram_via": "sac"},
|
||||
payload={"source": {"product": "rdp-login-monitor", "product_version": "1.2.31-SAC"}},
|
||||
)
|
||||
text = format_event_telegram_html(event)
|
||||
assert "✅ Мониторинг логинов ЗАПУЩЕН" in text
|
||||
assert "K6A-DC3 (10.0.0.1)" in text
|
||||
assert "Агент запущен" not in text
|
||||
assert "📡 Оповещение: SAC (Security Alert Center)" in text
|
||||
|
||||
|
||||
def test_lifecycle_footer_uses_telegram_via_agent_when_present():
|
||||
host = Host(hostname="WIN01", display_name="H1", os_family="windows")
|
||||
event = Event(
|
||||
|
||||
Reference in New Issue
Block a user