deer-flow/backend/tests/test_notification_groups.py
Totoro 5ae95e6a34
feat: add Feishu group notifications and fix mention caret placement (#6762)
* feat(feishu): deliver scheduled-task notifications to bound users

* feat: add Feishu group notifications and fix mention caret placement

* fix(frontend): preserve group targets while capabilities load

---------

Co-authored-by: Totoro-qaq <279883115+Totoro-qaq@users.noreply.github.com>
2026-10-13 07:17:56 +08:00

29 lines
1.2 KiB
Python

"""The group predicate accepts only a recorded connected Feishu group."""
import pytest
@pytest.mark.parametrize(
"overrides,expected",
[
({}, True),
({"provider": "wecom"}, False),
({"status": "revoked"}, False),
({"workspace_id": None}, False),
({"workspace_id": ""}, False),
({"workspace_id": " ", "metadata": {"chat_id": " ", "chat_type": "group"}}, False),
({"workspace_id": "oc_other"}, False),
({"metadata": None}, False),
({"metadata": []}, False),
({"metadata": {"chat_id": "oc_group"}}, False),
({"metadata": {"chat_id": "oc_group", "chat_type": "p2p"}}, False),
({"metadata": {"chat_id": "", "chat_type": "group"}}, False),
({"metadata": {"chat_id": ["oc_group"], "chat_type": "group"}}, False),
],
)
def test_feishu_group_predicate(overrides, expected):
from app.channels.notification_groups import is_feishu_notification_group
value = {"provider": "feishu", "status": "connected", "workspace_id": "oc_group", "metadata": {"chat_id": "oc_group", "chat_type": "group"}, **overrides}
assert is_feishu_notification_group(**value) is expected