feat: 支持按项目配置钉钉通知 @ 名单

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-11-03 09:59:05 +09:00
co-authored by Claude Opus 5.5
parent a4cd855b0c
commit 10c39b5116
7 changed files with 90 additions and 6 deletions
+18
View File
@@ -142,3 +142,21 @@ def test_dingtalk_notification_sends_markdown():
def test_dingtalk_notification_requires_webhook_when_enabled():
with pytest.raises(NotificationError, match="Webhook"):
send_dingtalk_notification({"enabled": True}, _build_config(), "https://download.example.com/app")
def test_project_at_mobiles_override_global_per_build_type():
from backend.services.notification import merge_project_at_mobiles
global_config = {"enabled": True, "at_mobiles": ["111"], "at_mobiles_app_store": ["222"]}
merged = merge_project_at_mobiles(global_config, {"at_mobiles": ["333", "333", " "], "at_mobiles_app_store": []})
assert merged["at_mobiles"] == ["333"]
assert merged["at_mobiles_app_store"] == ["222"] # 项目未配置,沿用全局
assert global_config["at_mobiles"] == ["111"] # 不修改全局配置
def test_project_at_mobiles_missing_keeps_global():
from backend.services.notification import merge_project_at_mobiles
global_config = {"at_mobiles": ["111"]}
assert merge_project_at_mobiles(global_config, None) == global_config