| 1234567891011121314151617181920212223242526 |
- from src.metals_mcp.mcp_tools import client, get_capabilities, get_candles, get_last_candle, get_price
- def test_capabilities():
- caps = get_capabilities()
- assert caps["server"] == "metals-mcp"
- def test_scaffold_tools():
- assert get_price("XAU/USD")["symbol"] == "XAU/USD"
- assert get_candles("XAU/USD")["candles"] == []
- assert get_last_candle("XAU/USD")["candle"] is None
- def test_price_supports_counter_currency(monkeypatch):
- monkeypatch.setattr(client, "pair_is_supported", lambda symbol, counter_currency=None: True)
- class DummyQuote:
- mid = 4049.0
- timestamp = 1234567890
- monkeypatch.setattr(client, "fetch_quote", lambda pair: DummyQuote())
- quote = get_price("XAU", counter_currency="EUR")
- assert quote["pair"] == "XAU/EUR"
- assert quote["counter_currency"] == "EUR"
- assert quote["price"] == 4049.0
|