MCPcopy Create free account
hub / github.com/IBM/mcp-cli / test_dashboard_bridge_wired

Method test_dashboard_bridge_wired

tests/agents/test_loop.py:203–228  ·  view source on GitHub ↗

Loop wires dashboard bridge input queue and broadcasts messages.

(self)

Source from the content-addressed store, hash-verified

201
202 @pytest.mark.asyncio
203 async def test_dashboard_bridge_wired(self):
204 """Loop wires dashboard bridge input queue and broadcasts messages."""
205 ctx = _make_context()
206 bridge = MagicMock()
207 bridge.set_input_queue = MagicMock()
208 bridge.on_message = AsyncMock()
209 ctx.dashboard_bridge = bridge
210
211 ui = _make_ui()
212 q: asyncio.Queue = asyncio.Queue()
213 done = asyncio.Event()
214
215 await q.put("hello")
216 await q.put("exit")
217
218 mock_convo = MagicMock()
219 mock_convo.process_conversation = AsyncMock()
220
221 with patch(
222 "mcp_cli.chat.conversation.ConversationProcessor",
223 return_value=mock_convo,
224 ):
225 await run_agent_loop(ctx, ui, q, done)
226
227 bridge.set_input_queue.assert_called_once_with(q)
228 bridge.on_message.assert_called_once_with("user", "hello")
229
230 @pytest.mark.asyncio
231 async def test_max_response_length_truncated(self):

Callers

nothing calls this directly

Calls 3

run_agent_loopFunction · 0.90
_make_contextFunction · 0.70
_make_uiFunction · 0.70

Tested by

no test coverage detected