Reset auto USDC cooldown in unit tests for stable assertions.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -34,6 +34,9 @@ def test_skip_non_okx() -> None:
|
||||
|
||||
def test_sim_convert_to_2x_need() -> None:
|
||||
"""USDC 不足 → 交易账户兑到 需×2(预留永续保证金)。"""
|
||||
import app.strategy.auto_usdc as m
|
||||
|
||||
m._last_attempt_ts = 0.0
|
||||
cap = {
|
||||
"option_need_usdc": 100.0,
|
||||
"option_have_usdc": 20.0,
|
||||
@@ -73,6 +76,9 @@ def test_sim_convert_to_2x_need() -> None:
|
||||
|
||||
def test_reserve_perp_margin() -> None:
|
||||
"""可兑 USDT = 交易 USDT − 永续所需。"""
|
||||
import app.strategy.auto_usdc as m
|
||||
|
||||
m._last_attempt_ts = 0.0
|
||||
cap = {
|
||||
"option_need_usdc": 100.0,
|
||||
"option_have_usdc": 0.0,
|
||||
@@ -93,7 +99,7 @@ def test_reserve_perp_margin() -> None:
|
||||
patch("app.strategy.auto_usdc.invalidate_live_balance_cache"),
|
||||
):
|
||||
gs.return_value.is_sim = True
|
||||
r = ensure_okx_trading_usdc(db=MagicMock(), cap=cap)
|
||||
r = ensure_okx_trading_usdc(db=MagicMock(), cap=cap, force=True)
|
||||
|
||||
assert r["acted"] is True
|
||||
assert wallets.convert.call_args.kwargs["amount"] == 50.0
|
||||
|
||||
Reference in New Issue
Block a user