sync update from LAN repo (source ji @ 85078a31)
This commit is contained in:
1 parent
5d6627af50
commit
e602d88695
864 files changed
+99150
-6346
No files matched your search
@@ -313,6 +313,49 @@ async def test_angle_crud_is_global_and_delete_is_soft(
|
||||
assert (tmp_path / "agents" / created.id / ".strategy-role.yaml").is_file()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_strategy_update_retains_existing_offline_skill_but_rejects_new_one(
|
||||
tmp_path: Path,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
request, _, _ = await _request(tmp_path, monkeypatch)
|
||||
created = await strategy_agents.create_strategy_angle(
|
||||
strategy_agents.StrategyAngleCreateRequest(
|
||||
name="下线技能保留测试",
|
||||
skills=["public-skill"],
|
||||
),
|
||||
request,
|
||||
)
|
||||
|
||||
storage = agents_router.get_or_new_skill_storage()
|
||||
public_skill = next(skill for skill in storage._skills if skill.name == "public-skill")
|
||||
public_skill.enabled = False
|
||||
|
||||
retained = await strategy_agents.update_strategy_agent(
|
||||
created.id,
|
||||
strategy_agents.StrategyAgentUpdateRequest(
|
||||
description="只改说明并原样保留已下线技能",
|
||||
skills=["public-skill"],
|
||||
),
|
||||
request,
|
||||
)
|
||||
assert retained.skills == ["public-skill"]
|
||||
|
||||
newly_offline = _skill("new-offline")
|
||||
newly_offline.enabled = False
|
||||
storage._skills.append(newly_offline)
|
||||
with pytest.raises(HTTPException) as exc_info:
|
||||
await strategy_agents.update_strategy_agent(
|
||||
created.id,
|
||||
strategy_agents.StrategyAgentUpdateRequest(
|
||||
skills=["public-skill", "new-offline"],
|
||||
),
|
||||
request,
|
||||
)
|
||||
assert exc_info.value.status_code == 422
|
||||
assert "new-offline" in str(exc_info.value.detail)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_memory_mode_recovers_dynamic_angle_from_folder_sidecar(
|
||||
tmp_path: Path,
|
||||
|
||||
Reference in new issue
Block a user