market-assistant/backend/pipeline/tests/test_strategy_config.py
hub-gif 7d219feb3c feat(pipeline): 策略页独立 strategy_config 与仅规则稿选项
新增 PipelineJob.strategy_config(默认 use_llm_default);GET /api/strategy-config-defaults/;PATCH 任务可保存策略偏好。策略生成页:本次仅规则稿复选框(默认关)、保存策略偏好、任务下拉去掉目录;第九章对齐仍由服务端默认处理。迁移 0021。

Made-with: Cursor
2026-04-17 16:41:20 +08:00

23 lines
695 B
Python

"""策略页独立 ``strategy_config`` 校验。"""
from __future__ import annotations
import pytest
from rest_framework import serializers
from pipeline.serializers import validate_strategy_config_body
def test_validate_strategy_config_merges_default() -> None:
out = validate_strategy_config_body({})
assert out["use_llm_default"] is False
def test_validate_strategy_config_unknown_key() -> None:
with pytest.raises(serializers.ValidationError):
validate_strategy_config_body({"foo": 1})
def test_validate_strategy_config_use_llm_type() -> None:
with pytest.raises(serializers.ValidationError):
validate_strategy_config_body({"use_llm_default": "yes"})