mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-10-26 13:16:24 +00:00
fix(tests): adapt GroundRoute URL screening fixture to async transport (#7263)
This commit is contained in:
parent
7e1f814b2c
commit
0efd95568d
@ -1,5 +1,9 @@
|
||||
# Backend Tests
|
||||
|
||||
`test_image_result_url_safety.py` drives GroundRoute through `ainvoke` and an
|
||||
offline HTTPX transport. Patch only the provider's `httpx` reference; preserve
|
||||
the shared client and exercise real configuration resolution and URL screening.
|
||||
|
||||
`test_client_upload_snapshot.py` keeps upload publication and conversion on the
|
||||
same private capture. Cover source edits/removal, both conversion branches,
|
||||
same-file rejection, metadata and cleanup; retain sandbox symlink defenses.
|
||||
|
||||
@ -95,7 +95,17 @@ def _stub_serply(module, url):
|
||||
|
||||
def _stub_groundroute(module, url):
|
||||
data = {"results": [{"title": "t", "url": url, "snippet": "c"}]}
|
||||
return [patch.object(module, "_get_api_key", return_value="k"), patch.object(module, "_post_search", return_value=data)], _sync(module.web_search_tool)
|
||||
config = SimpleNamespace(get_tool_config=lambda _: SimpleNamespace(model_extra={"api_key": "synthetic-test-key"}))
|
||||
transport = httpx.MockTransport(lambda request: httpx.Response(200, json=data))
|
||||
real_client = httpx.AsyncClient
|
||||
return [
|
||||
patch.object(module, "get_app_config", return_value=config),
|
||||
patch.object(
|
||||
module,
|
||||
"httpx",
|
||||
SimpleNamespace(AsyncClient=lambda **kwargs: real_client(transport=transport, **kwargs), HTTPStatusError=httpx.HTTPStatusError),
|
||||
),
|
||||
], _async(module.web_search_tool)
|
||||
|
||||
|
||||
def _stub_sofya(module, url):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user