mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-06 16:07:01 +08:00
refactor: inject agent runtime settings
This commit is contained in:
@@ -2,6 +2,8 @@ import shutil
|
||||
import tempfile
|
||||
import textwrap
|
||||
import unittest
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import patch
|
||||
from pathlib import Path
|
||||
|
||||
from app.agent.runtime import AgentRuntimeManager
|
||||
@@ -23,6 +25,16 @@ class TestAgentRuntimeConfig(unittest.TestCase):
|
||||
bundled_defaults_dir=self.defaults_root,
|
||||
)
|
||||
|
||||
def test_default_root_uses_runtime_settings_service(self):
|
||||
"""未显式传入目录时,管理器应读取组合根提供的配置目录。"""
|
||||
config_root = self.temp_root / "configured"
|
||||
service = SimpleNamespace(get=lambda key: config_root if key == "CONFIG_PATH" else None)
|
||||
|
||||
with patch("app.agent.runtime.get_runtime_settings", return_value=service):
|
||||
manager = AgentRuntimeManager(bundled_defaults_dir=self.defaults_root)
|
||||
|
||||
self.assertEqual(manager.agent_root_dir, config_root / "agent")
|
||||
|
||||
def test_load_runtime_config_syncs_defaults_and_parses_sections(self):
|
||||
manager = self._manager()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user