feat: add favorite task templates and optimize evidence exports
This commit is contained in:
1 parent
e1ea099592
commit
a4a5430922
46 files changed
+1714
-188
No files matched your search
@@ -7,6 +7,39 @@ import pytest
|
||||
from mcp_server.tools import automation as tools
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_favorites_share_backend_preserve_request_id_and_refuse_secrets(monkeypatch):
|
||||
request = AsyncMock(return_value={"id": "favorite"})
|
||||
monkeypatch.setattr(tools, "_request", request)
|
||||
await tools.mobile_favorites("create", source_kind="batch", source_id="source")
|
||||
request.assert_awaited_once_with(
|
||||
"POST",
|
||||
"/api/automation/favorites",
|
||||
json={"source_kind": "batch", "source_id": "source", "version": None},
|
||||
)
|
||||
request.reset_mock()
|
||||
with pytest.raises(ValueError):
|
||||
await tools.mobile_favorites("run", favorite_id="favorite")
|
||||
with pytest.raises(ValueError, match="密钥"):
|
||||
await tools.mobile_favorites(
|
||||
"update",
|
||||
favorite_id="favorite",
|
||||
changes={"case_configs": {"0": {"api_key": "never-send"}}},
|
||||
)
|
||||
request.assert_not_awaited()
|
||||
await tools.mobile_favorites(
|
||||
"run",
|
||||
favorite_id="favorite",
|
||||
request_id="stable",
|
||||
changes={"task_config": {"model": "original"}},
|
||||
)
|
||||
request.assert_awaited_once_with(
|
||||
"POST",
|
||||
"/api/automation/favorites/favorite/run",
|
||||
json={"task_config": {"model": "original"}, "request_id": "stable"},
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_config_requires_explicit_persistence_and_excludes_secrets(monkeypatch):
|
||||
request = AsyncMock(
|
||||
|
||||
Reference in new issue
Block a user