Skip to main content
Glama

Generalized MCP Server

by sarptandoven
test_azure.py1.26 kB
import json import pytest from unittest import mock import grpc from src.server import MCPServicer from src.generated import mcp_pb2 @pytest.fixture def servicer(): return MCPServicer() def test_azure_get_token(servicer): """Test Azure token retrieval with mock.""" with mock.patch('azure.identity.DefaultAzureCredential') as mock_cred: mock_instance = mock_cred.return_value mock_token = mock.MagicMock() mock_token.token = "fake-token" mock_instance.get_token.return_value = mock_token req = mcp_pb2.InvokeRequest( fq_name="azure_identity.DefaultAzureCredential.get_token", json_args='{"args": ["https://management.azure.com/.default"]}' ) resp = servicer.Invoke(req, grpc.ServicerContext()) result = json.loads(resp.json_result) assert "fake-token" in str(result) def test_azure_credential_creation(servicer): """Test Azure credential creation with mock.""" with mock.patch('azure.identity.DefaultAzureCredential') as mock_cred: mock_instance = mock_cred.return_value # Test that the credential can be instantiated assert mock_instance is not None mock_cred.assert_called_once()

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sarptandoven/generalized-mcp-converter'

If you have feedback or need assistance with the MCP directory API, please join our Discord server