Skip to content

Commit 28762be

Browse files
fix testcase for test_get_chart_data plugin
1 parent 1c911a0 commit 28762be

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/tests/api/plugins/test_chat_with_data_plugin.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,9 @@ async def test_get_chart_data_success(self, mock_get_agent, chat_plugin):
186186
# Mock thread deletion
187187
mock_client.agents.threads.delete.return_value = None
188188

189-
# Call the method
189+
# Call the method with combined input
190190
result = await chat_plugin.get_chart_data(
191-
"Create a bar chart",
192-
"Total calls by date: 2025-06-27: 11, 2025-06-28: 20"
191+
"Create a bar chart. Total calls by date: 2025-06-27: 11, 2025-06-28: 20"
193192
)
194193

195194
# Assert
@@ -198,7 +197,7 @@ async def test_get_chart_data_success(self, mock_get_agent, chat_plugin):
198197
mock_client.agents.messages.create.assert_called_once_with(
199198
thread_id="thread-id",
200199
role=MessageRole.USER,
201-
content="Current question: Create a bar chart, Last RAG response: Total calls by date: 2025-06-27: 11, 2025-06-28: 20"
200+
content="Create a bar chart. Total calls by date: 2025-06-27: 11, 2025-06-28: 20"
202201
)
203202
mock_client.agents.runs.create_and_process.assert_called_once_with(
204203
thread_id="thread-id",
@@ -227,8 +226,8 @@ async def test_get_chart_data_failed_run(self, mock_get_agent, chat_plugin):
227226
mock_run.last_error = "Chart generation failed"
228227
mock_client.agents.runs.create_and_process.return_value = mock_run
229228

230-
# Call the method
231-
result = await chat_plugin.get_chart_data("Create a chart", "Some data")
229+
# Call the method with single input parameter
230+
result = await chat_plugin.get_chart_data("Create a chart with some data")
232231

233232
# Assert
234233
assert result == "Details could not be retrieved. Please try again later."
@@ -245,8 +244,8 @@ async def test_get_chart_data_exception(self, mock_get_agent, chat_plugin):
245244
# Setup mock to raise exception
246245
mock_get_agent.side_effect = Exception("Chart agent error")
247246

248-
# Call the method
249-
result = await chat_plugin.get_chart_data("Create a chart", "Some data")
247+
# Call the method with single input parameter
248+
result = await chat_plugin.get_chart_data("Create a chart with some data")
250249

251250
# Assert
252251
assert result == "Details could not be retrieved. Please try again later."
@@ -276,8 +275,8 @@ async def test_get_chart_data_empty_response(self, mock_get_agent, chat_plugin):
276275
# Mock thread deletion
277276
mock_client.agents.threads.delete.return_value = None
278277

279-
# Call the method
280-
result = await chat_plugin.get_chart_data("Create a chart", "Some data")
278+
# Call the method with single input parameter
279+
result = await chat_plugin.get_chart_data("Create a chart with some data")
281280

282281
# Assert - should return empty string when no agent messages found
283282
assert result == ""

0 commit comments

Comments
 (0)