fix: salvage follow-ups for Feishu QR onboarding (#7706)
- Remove duplicate _setup_feishu() definition (old 3-line version left behind by cherry-pick — Python picked the new one but dead code remained) - Remove misleading 'Disable direct messages' DM option — the Feishu adapter has no DM policy mechanism, so 'disable' produced identical env vars to 'pairing'. Users who chose 'disable' would still see pairing prompts. Reduced to 3 options: pairing, allow-all, allowlist. - Fix test_probe_returns_bot_info_on_success and test_probe_returns_none_on_failure: patch FEISHU_AVAILABLE=True so probe_bot() takes the SDK path when lark_oapi is not installed
This commit is contained in:
@@ -248,6 +248,7 @@ class TestRenderQr:
|
||||
class TestProbeBot:
|
||||
"""Tests for bot connectivity verification."""
|
||||
|
||||
@patch("gateway.platforms.feishu.FEISHU_AVAILABLE", True)
|
||||
def test_probe_returns_bot_info_on_success(self):
|
||||
from gateway.platforms.feishu import probe_bot
|
||||
|
||||
@@ -259,6 +260,7 @@ class TestProbeBot:
|
||||
assert result["bot_name"] == "TestBot"
|
||||
assert result["bot_open_id"] == "ou_bot123"
|
||||
|
||||
@patch("gateway.platforms.feishu.FEISHU_AVAILABLE", True)
|
||||
def test_probe_returns_none_on_failure(self):
|
||||
from gateway.platforms.feishu import probe_bot
|
||||
|
||||
|
||||
@@ -181,11 +181,6 @@ class TestSetupFeishuDmPolicy:
|
||||
env = self._run_with_dm_choice(2, prompt_responses=["ou_owner", ""])
|
||||
assert env["FEISHU_ALLOWED_USERS"] == "ou_owner"
|
||||
|
||||
def test_disabled_sets_feishu_allow_all_false(self):
|
||||
env = self._run_with_dm_choice(3)
|
||||
assert env["FEISHU_ALLOW_ALL_USERS"] == "false"
|
||||
assert env["FEISHU_ALLOWED_USERS"] == ""
|
||||
assert "GATEWAY_ALLOW_ALL_USERS" not in env
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user