|
|
@@ -599,7 +599,7 @@ async def test_business_updates_are_idempotent_and_manual_reply_pauses(app_modul
|
|
|
assert len(runtime.api.sent) == 1
|
|
|
|
|
|
|
|
|
-async def test_every_customer_message_notifies_feishu_once(app_modules):
|
|
|
+async def test_every_user_message_notifies_feishu_once(app_modules):
|
|
|
dbassistant, _service, runtime, _knowledge = await prepare_runtime(app_modules)
|
|
|
webhook_url = "https://open.feishu.cn/open-apis/bot/v2/hook/12345678-abcd-4321-abcd-123456789abc"
|
|
|
await dbassistant.update_account_settings(
|
|
|
@@ -625,6 +625,10 @@ async def test_every_customer_message_notifies_feishu_once(app_modules):
|
|
|
assert feishu.sent[0]["webhook_url"] == webhook_url
|
|
|
assert feishu.sent[0]["signing_secret"] == "secret"
|
|
|
assert "营业时间是什么" not in feishu.sent[0]["text"]
|
|
|
+ assert feishu.sent[0]["text"].startswith("消息提醒\n")
|
|
|
+ assert "用户:" in feishu.sent[0]["text"]
|
|
|
+ assert "客户:" not in feishu.sent[0]["text"]
|
|
|
+ assert "消息标识:" not in feishu.sent[0]["text"]
|
|
|
|
|
|
await dbassistant.update_account_settings(
|
|
|
"conn-a", {"feishu_message_preview_enabled": True}
|
|
|
@@ -633,12 +637,12 @@ async def test_every_customer_message_notifies_feishu_once(app_modules):
|
|
|
{
|
|
|
"update_id": 103,
|
|
|
"business_message": customer_message(
|
|
|
- message_id=2, text="第二条客户消息"
|
|
|
+ message_id=2, text="第二条用户消息"
|
|
|
),
|
|
|
}
|
|
|
)
|
|
|
assert len(feishu.sent) == 2
|
|
|
- assert "第二条客户消息" in feishu.sent[1]["text"]
|
|
|
+ assert "第二条用户消息" in feishu.sent[1]["text"]
|
|
|
|
|
|
await runtime.process_update(
|
|
|
{
|
|
|
@@ -934,11 +938,11 @@ async def test_feishu_webhook_signature_and_success_contract(app_modules):
|
|
|
client = service.FeishuWebhookClient(session)
|
|
|
await client.send(
|
|
|
"https://open.feishu.cn/open-apis/bot/v2/hook/12345678-abcd-4321-abcd-123456789abc",
|
|
|
- "Telegram 新消息提醒",
|
|
|
+ "消息提醒",
|
|
|
signing_secret="secret",
|
|
|
)
|
|
|
assert session.payload["msg_type"] == "text"
|
|
|
- assert session.payload["content"]["text"] == "Telegram 新消息提醒"
|
|
|
+ assert session.payload["content"]["text"] == "消息提醒"
|
|
|
assert session.payload["timestamp"]
|
|
|
assert session.payload["sign"]
|
|
|
|