feat(V2): migrazione bybit completa (client, tools, router, test, builder)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,34 @@ async def test_build_client_deribit_returns_correct_url(monkeypatch):
|
||||
assert "test" not in c_live.base_url.lower()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_build_client_bybit_returns_correct_env(monkeypatch):
|
||||
from tests.unit.test_settings import _minimal_env
|
||||
|
||||
for k, v in _minimal_env().items():
|
||||
monkeypatch.setenv(k, v)
|
||||
|
||||
# Stub pybit HTTP per evitare connessione reale durante __init__
|
||||
from cerbero_mcp.exchanges.bybit import client as bybit_client
|
||||
|
||||
class _FakeHTTP:
|
||||
def __init__(self, **kwargs):
|
||||
self.kwargs = kwargs
|
||||
|
||||
monkeypatch.setattr(bybit_client, "HTTP", _FakeHTTP)
|
||||
|
||||
from cerbero_mcp.settings import Settings
|
||||
from cerbero_mcp.exchanges import build_client
|
||||
|
||||
s = Settings()
|
||||
c_test = await build_client(s, "bybit", "testnet")
|
||||
c_live = await build_client(s, "bybit", "mainnet")
|
||||
|
||||
assert c_test is not c_live
|
||||
assert c_test.testnet is True
|
||||
assert c_live.testnet is False
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_build_client_unknown_exchange_raises(monkeypatch):
|
||||
from tests.unit.test_settings import _minimal_env
|
||||
|
||||
Reference in New Issue
Block a user