@@ -228,6 +228,123 @@ async def test_set_status_requires_status(self):
228228 with pytest .raises (TypeError ):
229229 await agent .set_status ()
230230
231+ @pytest .mark .asyncio
232+ async def test_set_suggested_prompts_uses_context_defaults (self ):
233+ """AsyncBoltAgent.set_suggested_prompts() passes context defaults to AsyncWebClient.assistant_threads_setSuggestedPrompts()."""
234+ client = MagicMock (spec = AsyncWebClient )
235+ client .assistant_threads_setSuggestedPrompts , call_tracker , _ = _make_async_api_mock ()
236+
237+ agent = AsyncBoltAgent (
238+ client = client ,
239+ channel_id = "C111" ,
240+ thread_ts = "1234567890.123456" ,
241+ team_id = "T111" ,
242+ user_id = "W222" ,
243+ )
244+ await agent .set_suggested_prompts (prompts = ["What can you do?" , "Help me write code" ])
245+
246+ call_tracker .assert_called_once_with (
247+ channel_id = "C111" ,
248+ thread_ts = "1234567890.123456" ,
249+ prompts = [
250+ {"title" : "What can you do?" , "message" : "What can you do?" },
251+ {"title" : "Help me write code" , "message" : "Help me write code" },
252+ ],
253+ title = None ,
254+ )
255+
256+ @pytest .mark .asyncio
257+ async def test_set_suggested_prompts_with_dict_prompts (self ):
258+ """AsyncBoltAgent.set_suggested_prompts() accepts dict prompts with title and message."""
259+ client = MagicMock (spec = AsyncWebClient )
260+ client .assistant_threads_setSuggestedPrompts , call_tracker , _ = _make_async_api_mock ()
261+
262+ agent = AsyncBoltAgent (
263+ client = client ,
264+ channel_id = "C111" ,
265+ thread_ts = "1234567890.123456" ,
266+ team_id = "T111" ,
267+ user_id = "W222" ,
268+ )
269+ await agent .set_suggested_prompts (
270+ prompts = [
271+ {"title" : "Short title" , "message" : "A much longer message for this prompt" },
272+ ],
273+ title = "Suggestions" ,
274+ )
275+
276+ call_tracker .assert_called_once_with (
277+ channel_id = "C111" ,
278+ thread_ts = "1234567890.123456" ,
279+ prompts = [
280+ {"title" : "Short title" , "message" : "A much longer message for this prompt" },
281+ ],
282+ title = "Suggestions" ,
283+ )
284+
285+ @pytest .mark .asyncio
286+ async def test_set_suggested_prompts_overrides_context_defaults (self ):
287+ """Explicit channel/thread_ts override context defaults."""
288+ client = MagicMock (spec = AsyncWebClient )
289+ client .assistant_threads_setSuggestedPrompts , call_tracker , _ = _make_async_api_mock ()
290+
291+ agent = AsyncBoltAgent (
292+ client = client ,
293+ channel_id = "C111" ,
294+ thread_ts = "1234567890.123456" ,
295+ team_id = "T111" ,
296+ user_id = "W222" ,
297+ )
298+ await agent .set_suggested_prompts (
299+ prompts = ["Hello" ],
300+ channel = "C999" ,
301+ thread_ts = "9999999999.999999" ,
302+ )
303+
304+ call_tracker .assert_called_once_with (
305+ channel_id = "C999" ,
306+ thread_ts = "9999999999.999999" ,
307+ prompts = [{"title" : "Hello" , "message" : "Hello" }],
308+ title = None ,
309+ )
310+
311+ @pytest .mark .asyncio
312+ async def test_set_suggested_prompts_passes_extra_kwargs (self ):
313+ """Extra kwargs are forwarded to AsyncWebClient.assistant_threads_setSuggestedPrompts()."""
314+ client = MagicMock (spec = AsyncWebClient )
315+ client .assistant_threads_setSuggestedPrompts , call_tracker , _ = _make_async_api_mock ()
316+
317+ agent = AsyncBoltAgent (
318+ client = client ,
319+ channel_id = "C111" ,
320+ thread_ts = "1234567890.123456" ,
321+ team_id = "T111" ,
322+ user_id = "W222" ,
323+ )
324+ await agent .set_suggested_prompts (prompts = ["Hello" ], token = "xoxb-override" )
325+
326+ call_tracker .assert_called_once_with (
327+ channel_id = "C111" ,
328+ thread_ts = "1234567890.123456" ,
329+ prompts = [{"title" : "Hello" , "message" : "Hello" }],
330+ title = None ,
331+ token = "xoxb-override" ,
332+ )
333+
334+ @pytest .mark .asyncio
335+ async def test_set_suggested_prompts_requires_prompts (self ):
336+ """set_suggested_prompts() raises TypeError when prompts is not provided."""
337+ client = MagicMock (spec = AsyncWebClient )
338+ agent = AsyncBoltAgent (
339+ client = client ,
340+ channel_id = "C111" ,
341+ thread_ts = "1234567890.123456" ,
342+ team_id = "T111" ,
343+ user_id = "W222" ,
344+ )
345+ with pytest .raises (TypeError ):
346+ await agent .set_suggested_prompts ()
347+
231348 @pytest .mark .asyncio
232349 async def test_import_from_agent_module (self ):
233350 from slack_bolt .agent .async_agent import AsyncBoltAgent as ImportedAsyncBoltAgent
0 commit comments