feat(V2): migrazione sentiment completa (read-only, env ignored)
- exchanges/sentiment/{client,fetchers,tools}.py: SentimentClient wrapper stateless (cryptopanic_key, lunarcrush_key)
- routers/sentiment.py: 9 tool POST sotto /mcp-sentiment (news, social, funding, OI, liquidations, cointegration)
- exchanges/__init__.py: branch builder per sentiment (env ignored)
- tests/unit/exchanges/sentiment: migrato test_fetchers, scartato test_server_acl V1-only
- tests/unit/test_exchanges_builder.py: aggiunto test_build_client_sentiment_no_env_distinction
- fetchers.py: env var lookup allineato a LUNARCRUSH_KEY (con fallback LUNARCRUSH_API_KEY)
241 test passano.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -125,6 +125,29 @@ async def test_build_client_macro_no_env_distinction(monkeypatch):
|
||||
assert c_test.finnhub_api_key == c_live.finnhub_api_key
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_build_client_sentiment_no_env_distinction(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
|
||||
from cerbero_mcp.exchanges.sentiment.client import SentimentClient
|
||||
|
||||
s = Settings()
|
||||
c_test = await build_client(s, "sentiment", "testnet")
|
||||
c_live = await build_client(s, "sentiment", "mainnet")
|
||||
|
||||
# entrambi sono SentimentClient validi (env ignorato)
|
||||
assert isinstance(c_test, SentimentClient)
|
||||
assert isinstance(c_live, SentimentClient)
|
||||
# Stesse credenziali (env ignorato)
|
||||
assert c_test.cryptopanic_key == c_live.cryptopanic_key
|
||||
assert c_test.lunarcrush_key == c_live.lunarcrush_key
|
||||
|
||||
|
||||
@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