2026-03-19 18:42:35 +08:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
from schemas.agent.system_agent import SystemAgentLLMConfig
|
|
|
|
|
|
|
|
|
|
|
2026-04-22 17:09:37 +08:00
|
|
|
def test_system_agent_llm_config_normalizes_enabled_skills() -> None:
|
2026-03-19 18:42:35 +08:00
|
|
|
config = SystemAgentLLMConfig.model_validate(
|
|
|
|
|
{
|
2026-04-22 17:09:37 +08:00
|
|
|
"enabled_skills": ["calendar", "calendar", "contacts"]
|
2026-03-19 18:42:35 +08:00
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
2026-04-22 17:09:37 +08:00
|
|
|
assert [skill.value for skill in config.enabled_skills] == ["calendar", "contacts"]
|
2026-03-19 18:42:35 +08:00
|
|
|
|
|
|
|
|
|
2026-04-22 17:09:37 +08:00
|
|
|
def test_system_agent_llm_config_rejects_unknown_enabled_skill() -> None:
|
|
|
|
|
with pytest.raises(ValueError):
|
2026-03-19 18:42:35 +08:00
|
|
|
SystemAgentLLMConfig.model_validate(
|
|
|
|
|
{
|
2026-04-22 17:09:37 +08:00
|
|
|
"enabled_skills": ["calendar.remove"],
|
2026-03-19 18:42:35 +08:00
|
|
|
}
|
|
|
|
|
)
|