fix: Telegram footer shows SAC as sender when SAC delivers the message

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-31 12:41:23 +10:00
parent 366a9c83f7
commit 9dacbd7944
3 changed files with 43 additions and 7 deletions
+21 -2
View File
@@ -65,7 +65,7 @@ def test_rdp_success_template():
text = format_event_telegram_html(event)
assert "УСПЕШНЫЙ" in text
assert "Сеть/RDP" in text
assert "📡 Оповещение: агент" in text
assert "📡 Оповещение: SAC (Security Alert Center)" in text
def test_event_telegram_includes_sac_source_for_sac_daily_report():
@@ -107,7 +107,26 @@ def test_lifecycle_started_template():
assert "K6A-DC3" in text
assert "1.2.30-SAC" in text
assert "загрузка ОС" in text
assert "📡 Оповещение: агент" 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(
event_id="00000000-0000-4000-8000-000000000506",
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="x",
details={"lifecycle": "started", "telegram_via": "agent"},
payload={"source": {"product": "rdp-login-monitor", "product_version": "1.2.30-SAC"}},
)
text = format_event_telegram_html(event)
assert "📡 Оповещение: агент (rdp-login-monitor 1.2.30-SAC)" in text
def test_rdp_shadow_control_template():