diff --git a/tests/tools/test_web_search_tool.py b/tests/tools/test_web_search_tool.py index 0caee43b8..60c26a511 100644 --- a/tests/tools/test_web_search_tool.py +++ b/tests/tools/test_web_search_tool.py @@ -369,21 +369,25 @@ async def test_duckduckgo_search(monkeypatch): async def test_duckduckgo_search_passes_proxy(monkeypatch): """DDGS client must receive the configured proxy so search works behind a proxy.""" captured: dict = {} + proxy_url = "http://proxy.example:8080" class ProxyCaptorDDGS: def __init__(self, **kw): captured.update(kw) def text(self, query, max_results=5): - return [{"title": "Proxied", "href": "https://ddg.example", "body": "OK"}] + return [{"title": "Result", "href": "https://example.com", "body": "OK"}] monkeypatch.setattr("ddgs.DDGS", ProxyCaptorDDGS) - tool = _tool(provider="duckduckgo") - tool.proxy = "http://192.168.1.1:8080" - result = await tool.execute(query="hello") - assert captured.get("proxy") == "http://192.168.1.1:8080" - assert "Proxied" in result + tool = WebSearchTool( + config=WebSearchConfig(provider="duckduckgo"), + proxy=proxy_url, + ) + result = await tool.execute(query="test") + assert captured["proxy"] == proxy_url + assert captured["timeout"] == 10 + assert "Result" in result @pytest.mark.asyncio