feat(external-connector): 默认连接器提供者改为官方版本
将环境变量 CONNECTOR_PROVIDER 的默认值从 "fake" 改为 "official", 以便在没有明确指定提供者时使用官方的连接器实现。
This commit is contained in:
24
external-connector/tests/test_main.py
Normal file
24
external-connector/tests/test_main.py
Normal file
@ -0,0 +1,24 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from external_connector import main
|
||||
|
||||
|
||||
def test_build_app_defaults_to_official_provider(monkeypatch, tmp_path) -> None:
|
||||
monkeypatch.delenv("CONNECTOR_PROVIDER", raising=False)
|
||||
monkeypatch.setenv("CONNECTOR_HOME", str(tmp_path))
|
||||
|
||||
app = main.build_app()
|
||||
health = next(route.endpoint for route in app.routes if route.path == "/health")()
|
||||
|
||||
assert health["providerId"] == "composite"
|
||||
assert [provider["providerId"] for provider in health["providers"]] == ["weixin_ilink", "feishu_bot"]
|
||||
|
||||
|
||||
def test_build_app_allows_explicit_fake_provider(monkeypatch, tmp_path) -> None:
|
||||
monkeypatch.setenv("CONNECTOR_PROVIDER", "fake")
|
||||
monkeypatch.setenv("CONNECTOR_HOME", str(tmp_path))
|
||||
|
||||
app = main.build_app()
|
||||
health = next(route.endpoint for route in app.routes if route.path == "/health")()
|
||||
|
||||
assert health["providerId"] == "fake"
|
||||
Reference in New Issue
Block a user