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

Method test_simple_response

tests/chat/test_conversation.py:175–195  ·  view source on GitHub ↗

Test processing a simple text response.

(self)

Source from the content-addressed store, hash-verified

173
174 @pytest.mark.asyncio
175 async def test_simple_response(self):
176 """Test processing a simple text response."""
177 context = MockContext()
178 context.conversation_history = [Message(role=MessageRole.USER, content="Hello")]
179 context.openai_tools = []
180
181 # Mock client response
182 context.client.create_completion = AsyncMock(
183 return_value={"response": "Hello! How can I help?", "tool_calls": None}
184 )
185
186 ui_manager = MockUIManager()
187 ui_manager.print_assistant_message = AsyncMock()
188
189 processor = ConversationProcessor(context, ui_manager)
190 await processor.process_conversation()
191
192 # Should have added assistant message to history
193 assert len(context.conversation_history) == 2
194 assert context.conversation_history[-1].role == MessageRole.ASSISTANT
195 assert "Hello" in context.conversation_history[-1].content
196
197 @pytest.mark.asyncio
198 async def test_max_turns_limit(self):

Callers

nothing calls this directly

Calls 5

process_conversationMethod · 0.95
MessageClass · 0.85
MockContextClass · 0.70
MockUIManagerClass · 0.70

Tested by

no test coverage detected