refactor: 重构 schemas 结构,统一枚举定义
This commit is contained in:
@@ -2,23 +2,25 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from schemas.automation.config import AutomationJobConfig, default_memory_job_config
|
||||
from schemas.domain.automation import AutomationJobConfig
|
||||
from v1.auth.automation_static_config import load_static_automation_job_config
|
||||
|
||||
|
||||
def test_default_memory_job_config_has_expected_defaults() -> None:
|
||||
config = default_memory_job_config()
|
||||
def test_memory_extraction_static_config_has_expected_defaults() -> None:
|
||||
config = load_static_automation_job_config(config_name="memory_extraction")
|
||||
|
||||
assert config.agent_type.value == "memory"
|
||||
assert config.model_code == "qwen3.5-flash"
|
||||
assert "memory.write" in (config.enabled_tools or [])
|
||||
assert "memory.forget" in (config.enabled_tools or [])
|
||||
assert config.context is not None
|
||||
assert config.context.source.value == "latest_chat"
|
||||
assert config.schedule is not None
|
||||
assert config.schedule.type.value == "daily"
|
||||
|
||||
|
||||
def test_automation_job_config_rejects_non_flash_model() -> None:
|
||||
with pytest.raises(ValueError, match="model_code must be qwen3.5-flash"):
|
||||
def test_automation_job_config_rejects_missing_weekdays_for_weekly() -> None:
|
||||
with pytest.raises(ValueError, match="weekdays is required"):
|
||||
AutomationJobConfig.model_validate(
|
||||
{
|
||||
"agent_type": "memory",
|
||||
"model_code": "qwen-plus",
|
||||
"enabled_tools": ["calendar.read"],
|
||||
"input_template": "x",
|
||||
"context": {
|
||||
@@ -26,5 +28,9 @@ def test_automation_job_config_rejects_non_flash_model() -> None:
|
||||
"window_mode": "day",
|
||||
"window_count": 2,
|
||||
},
|
||||
"schedule": {
|
||||
"type": "weekly",
|
||||
"run_at": {"hour": 9, "minute": 0},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user