test(guardrails): assert the scanned texts in the serialized tool output cases

Co-authored-by: feng.tsai <fengtsai@berri.ai>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
yucheng 2026-09-24 09:05:40 +00:00
parent c63bae89db
commit f47b978dfc

View file

@ -7249,6 +7249,9 @@ async def test_during_call_hook_chat_tool_output_attachment_scans_as_text():
)
mock_post.assert_called_once()
sent_body = json.loads(mock_post.call_args.kwargs["data"])
sent_texts = [item["text"]["text"] for item in sent_body["content"] if "text" in item]
assert tool_output in sent_texts
@pytest.mark.asyncio
@ -7640,6 +7643,9 @@ async def test_during_call_hook_chat_tool_output_metadata_members_scan_as_text(m
)
mock_post.assert_called_once()
sent_body = json.loads(mock_post.call_args.kwargs["data"])
sent_texts = [item["text"]["text"] for item in sent_body["content"] if "text" in item]
assert json.dumps([member]) in sent_texts
@pytest.mark.asyncio
@ -7687,6 +7693,9 @@ async def test_during_call_hook_responses_tool_output_metadata_members_scan_as_t
)
mock_post.assert_called_once()
sent_body = json.loads(mock_post.call_args.kwargs["data"])
sent_texts = [item["text"]["text"] for item in sent_body["content"] if "text" in item]
assert any(str(member.get("id", "")) in text or str(member.get("name", "")) in text for text in sent_texts)
@pytest.mark.asyncio