MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / test_control_wiki

Function test_control_wiki

tests/server/test_agent_server_e2e.py:663–696  ·  view source on GitHub ↗

wiki control inits the structure and reports status.

(tmp_path)

Source from the content-addressed store, hash-verified

661
662@pytest.mark.asyncio
663async def test_control_wiki(tmp_path):
664 """wiki control inits the structure and reports status."""
665 from src.tool_system.registry import ToolRegistry
666
667 with contextlib.ExitStack() as stack:
668 for p in _patches(_TextProvider, ToolRegistry([])):
669 stack.enter_context(p)
670 spawn = make_spawn_agent(AgentServerConfig(permission_mode="default"))
671 handle = await spawn("ds_test", str(tmp_path), None)
672 gen = handle.messages_from_agent()
673 try:
674 init = await asyncio.wait_for(gen.__anext__(), timeout=5)
675 assert init["subtype"] == "init"
676
677 async def _reply_for(rid, req):
678 await handle.send_to_agent({"type": "control_request", "request_id": rid, "request": req})
679 for _ in range(12):
680 msg = await asyncio.wait_for(gen.__anext__(), timeout=5)
681 if msg.get("type") == "control_response" and msg["response"].get("request_id") == rid:
682 return msg["response"]["response"]
683 raise AssertionError(f"no reply for {rid}")
684
685 before = await _reply_for("w0", {"subtype": "wiki", "action": "status"})
686 assert before["initialized"] is False
687
688 ini = await _reply_for("w1", {"subtype": "wiki", "action": "init"})
689 assert ini["ok"] is True and len(ini["created_files"]) >= 4
690
691 after = await _reply_for("w2", {"subtype": "wiki", "action": "status"})
692 assert after["initialized"] is True and after["page_count"] == 1
693 finally:
694 await handle.shutdown()
695 with contextlib.suppress(Exception):
696 await gen.aclose()
697
698
699@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 9

ToolRegistryClass · 0.90
make_spawn_agentFunction · 0.90
AgentServerConfigClass · 0.90
_patchesFunction · 0.85
_reply_forFunction · 0.85
__anext__Method · 0.80
spawnFunction · 0.70
shutdownMethod · 0.45
acloseMethod · 0.45

Tested by

no test coverage detected