feat(V2): builder client centralizzato (solo deribit per ora)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_build_client_deribit_returns_correct_url(monkeypatch):
|
||||
from tests.unit.test_settings import _minimal_env
|
||||
|
||||
for k, v in _minimal_env().items():
|
||||
monkeypatch.setenv(k, v)
|
||||
|
||||
from cerbero_mcp.settings import Settings
|
||||
from cerbero_mcp.exchanges import build_client
|
||||
|
||||
s = Settings()
|
||||
c_test = await build_client(s, "deribit", "testnet")
|
||||
c_live = await build_client(s, "deribit", "mainnet")
|
||||
|
||||
# DeribitClient espone base_url come property derivata da self.testnet
|
||||
assert "test" in c_test.base_url.lower()
|
||||
assert "test" not in c_live.base_url.lower()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_build_client_unknown_exchange_raises(monkeypatch):
|
||||
from tests.unit.test_settings import _minimal_env
|
||||
|
||||
for k, v in _minimal_env().items():
|
||||
monkeypatch.setenv(k, v)
|
||||
|
||||
from cerbero_mcp.settings import Settings
|
||||
from cerbero_mcp.exchanges import build_client
|
||||
|
||||
s = Settings()
|
||||
with pytest.raises(ValueError):
|
||||
await build_client(s, "ftx", "testnet")
|
||||
Reference in New Issue
Block a user