- Add test optional dependencies to pyproject.toml - Add conftest.py with fixtures for mocking settings and MCP client - Add test_server.py with tests for tryton_call and MCP tools
26 lines
519 B
Python
26 lines
519 B
Python
import pytest
|
|
import pytest_asyncio
|
|
from unittest.mock import MagicMock, patch
|
|
from fastmcp import Client
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_settings():
|
|
with patch("tryton_mcp.server.settings") as mock:
|
|
mock_client = MagicMock()
|
|
mock.get_client.return_value = mock_client
|
|
yield mock
|
|
|
|
|
|
@pytest.fixture
|
|
def mcp_server():
|
|
from tryton_mcp.server import mcp
|
|
|
|
return mcp
|
|
|
|
|
|
@pytest_asyncio.fixture
|
|
async def mcp_client(mcp_server):
|
|
async with Client(mcp_server) as client:
|
|
yield client
|