fix(awooop): mirror telegram outbound messages
This commit is contained in:
@@ -231,6 +231,43 @@ async def test_append_incident_update_suppresses_duplicate_failure_across_incide
|
||||
]
|
||||
|
||||
|
||||
def test_outbound_message_type_inference():
|
||||
"""Legacy Telegram 訊息 mirror 到 Channel Hub 時,必須映射成有限分類。"""
|
||||
|
||||
assert (
|
||||
telegram_gateway_module._infer_outbound_message_type(
|
||||
"ℹ️ ACTION REQUIRED | 低風險",
|
||||
{"reply_markup": {"inline_keyboard": []}},
|
||||
)
|
||||
== "approval_request"
|
||||
)
|
||||
assert (
|
||||
telegram_gateway_module._infer_outbound_message_type(
|
||||
"🤖❌ [AUTO] AI 自動修復失敗",
|
||||
{"reply_to_message_id": 123},
|
||||
)
|
||||
== "error"
|
||||
)
|
||||
assert (
|
||||
telegram_gateway_module._infer_outbound_message_type(
|
||||
"✅ 執行成功",
|
||||
{"reply_to_message_id": 123},
|
||||
)
|
||||
== "final"
|
||||
)
|
||||
|
||||
|
||||
def test_legacy_outbound_run_id_is_stable():
|
||||
"""沒有正式 run_id 的 legacy Telegram 發送,要有穩定 soft run_id 供查詢串接。"""
|
||||
|
||||
first = telegram_gateway_module._legacy_outbound_run_id("-1001", "42")
|
||||
second = telegram_gateway_module._legacy_outbound_run_id("-1001", "42")
|
||||
other = telegram_gateway_module._legacy_outbound_run_id("-1001", "43")
|
||||
|
||||
assert first == second
|
||||
assert first != other
|
||||
|
||||
|
||||
class TestSentryErrorMessage:
|
||||
"""測試 Sentry 錯誤訊息"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user