We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ravikant1918/mcp-server-upstox'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
import pytest
from unittest.mock import patch
import logging
import asyncio
from upstock_mcp.adapters.upstox_client import UpstoxClient
from upstox_client.rest import ApiException
def test_get_profile_logs_exception_and_raises(caplog):
client = UpstoxClient()
async def raise_api(*args, **kwargs):
raise ApiException("boom")
# Ensure the attribute exists so the attribute lookup happens without error
client.user_api.get_profile = lambda *args, **kwargs: None
# Patch the _run_sync to simulate ApiException
with patch.object(UpstoxClient, "_run_sync", side_effect=raise_api):
caplog.set_level(logging.ERROR)
with pytest.raises(ApiException):
asyncio.run(client.get_profile())
assert "Upstox API Error (get_profile)" in caplog.text