Break tool config schema import cycle
This commit is contained in:
@@ -352,50 +352,6 @@ def test_mcp_wrappers_not_discoverable():
|
||||
assert MCPPromptWrapper._plugin_discoverable is False
|
||||
|
||||
|
||||
# --- Task 8: Config round-trip tests ---
|
||||
|
||||
|
||||
def test_config_round_trip():
|
||||
"""Verify config serialization is unchanged after moving config classes."""
|
||||
from nanobot.config.schema import Config
|
||||
|
||||
config_dict = {
|
||||
"tools": {
|
||||
"web": {"enable": True, "search": {"provider": "brave", "api_key": "test"}},
|
||||
"exec": {"enable": False, "timeout": 120, "pathPrepend": "/venv/bin"},
|
||||
"my": {"allowSet": True},
|
||||
"imageGeneration": {"enabled": True, "provider": "openrouter"},
|
||||
}
|
||||
}
|
||||
config = Config.model_validate(config_dict)
|
||||
dumped = config.model_dump(mode="json", by_alias=True)
|
||||
|
||||
assert dumped["tools"]["my"]["allowSet"] is True
|
||||
assert dumped["tools"]["imageGeneration"]["enabled"] is True
|
||||
assert dumped["tools"]["exec"]["pathPrepend"] == "/venv/bin"
|
||||
assert config.tools.exec.enable is False
|
||||
assert config.tools.exec.timeout == 120
|
||||
assert config.tools.exec.path_prepend == "/venv/bin"
|
||||
assert config.tools.web.search.provider == "brave"
|
||||
|
||||
|
||||
def test_config_defaults():
|
||||
"""Verify default values match the original hardcoded schema."""
|
||||
from nanobot.config.schema import Config
|
||||
|
||||
config = Config.model_validate({})
|
||||
assert config.tools.exec.enable is True
|
||||
assert config.tools.exec.timeout == 60
|
||||
assert config.tools.exec.path_prepend == ""
|
||||
assert config.tools.web.enable is True
|
||||
assert config.tools.web.search.provider == "duckduckgo"
|
||||
assert config.tools.my.enable is True
|
||||
assert config.tools.my.allow_set is False
|
||||
assert config.tools.image_generation.enabled is False
|
||||
assert config.tools.cli_apps.enable is True
|
||||
assert config.tools.restrict_to_workspace is False
|
||||
|
||||
|
||||
# --- Task 10: Integration test ---
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user