Skip to content

Commit 6522094

Browse files
committed
Stabilize broker connector test
1 parent 435988f commit 6522094

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

tests/test_python_migration.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1669,7 +1669,30 @@ def test_mcp_stdio_and_http_minimum_surface(tmp_path: Path) -> None:
16691669
assert isinstance(batch.json(), list)
16701670

16711671

1672-
def test_head_manager_connector_tools_stop_before_execution(tmp_path: Path) -> None:
1672+
def test_head_manager_connector_tools_stop_before_execution(tmp_path: Path, monkeypatch) -> None:
1673+
from tradingcodex_service.application import brokers
1674+
1675+
def fake_binance_http_request(method: str, base_url: str, path: str, query: str, headers: dict[str, str]) -> dict:
1676+
assert method == "GET"
1677+
assert path == "/api/v3/exchangeInfo"
1678+
assert query == "symbol=BTCUSDT"
1679+
return {
1680+
"symbols": [
1681+
{
1682+
"symbol": "BTCUSDT",
1683+
"quoteAsset": "USDT",
1684+
"orderTypes": ["LIMIT", "MARKET"],
1685+
"timeInForce": ["GTC", "IOC", "FOK"],
1686+
"filters": [
1687+
{"filterType": "PRICE_FILTER", "tickSize": "0.01000000"},
1688+
{"filterType": "LOT_SIZE", "minQty": "0.00001000", "stepSize": "0.00001000"},
1689+
{"filterType": "MIN_NOTIONAL", "minNotional": "5.00000000"},
1690+
],
1691+
}
1692+
]
1693+
}
1694+
1695+
monkeypatch.setattr(brokers, "_binance_http_request", fake_binance_http_request)
16731696
workspace = make_workspace(tmp_path)
16741697
templates = call_mcp_tool(workspace, "list_broker_connector_templates", {"principal_id": "head-manager", "asset_class": "crypto"})
16751698
assert {"binance_spot", "upbit_spot_kr"}.issubset({template["template_id"] for template in templates["templates"]})

0 commit comments

Comments
 (0)