mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-14 22:17:00 +00:00
feat: harden webtool
This commit is contained in:
1 parent
3cbd284948
commit
64b3bd3356
20 files changed
+939
-80
No files matched your search
@@ -582,12 +582,12 @@ class TestReadWebpageErrors:
|
||||
|
||||
tool = ReadWebpageTool({})
|
||||
with patch(
|
||||
"application.agents.tools.read_webpage.pinned_request"
|
||||
) as mock_pinned_request:
|
||||
"application.agents.tools.read_webpage.pinned_fetch_bytes"
|
||||
) as mock_fetch:
|
||||
mock_response = MagicMock()
|
||||
mock_response.raise_for_status.return_value = None
|
||||
mock_response.text = "<html><body>test</body></html>"
|
||||
mock_pinned_request.return_value = mock_response
|
||||
mock_response.headers = {"Content-Type": "text/html"}
|
||||
mock_fetch.return_value = (b"<html><body>test</body></html>", mock_response)
|
||||
with patch(
|
||||
"application.agents.tools.read_webpage.markdownify",
|
||||
side_effect=Exception("parse error"),
|
||||
|
||||
Reference in new issue
Block a user