mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
refactor: add configuration dependency ratchet
This commit is contained in:
@@ -16,6 +16,21 @@ from app.schemas.types import SystemConfigKey
|
||||
|
||||
|
||||
class TestAgentSystemSettingsTools(unittest.TestCase):
|
||||
def test_query_system_settings_accepts_injected_reader(self):
|
||||
"""Agent 配置工具通过窄端口读取授权字段,无需自行构造数据库 Oper。"""
|
||||
reader = MagicMock()
|
||||
reader.get.return_value = [{"name": "qb", "enabled": True}]
|
||||
tool = QuerySystemSettingsTool(
|
||||
session_id="session-injected",
|
||||
user_id="10001",
|
||||
system_config=reader,
|
||||
)
|
||||
|
||||
payload = json.loads(asyncio.run(tool.run(setting_key="Downloaders")))
|
||||
|
||||
self.assertTrue(payload["success"])
|
||||
reader.get.assert_called_once_with(SystemConfigKey.Downloaders)
|
||||
|
||||
def test_query_system_settings_returns_exact_systemconfig_value(self):
|
||||
tool = QuerySystemSettingsTool(session_id="session-1", user_id="10001")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user