"""Pytest configuration and fixtures for registeruz-mcp tests."""
import os
from pathlib import Path
import pytest
import vcr
from fastmcp import Client
from registeruz_mcp import mcp
# Directory for VCR cassettes
CASSETTES_DIR = Path(__file__).parent / "cassettes"
# Configure VCR for httpx async client
my_vcr = vcr.VCR(
serializer="yaml",
cassette_library_dir=str(CASSETTES_DIR),
record_mode="once", # Record once, then replay
match_on=["uri", "method"],
filter_headers=["user-agent", "accept-encoding"],
decode_compressed_response=True,
)
@pytest.fixture
def vcr_config():
"""VCR configuration for pytest-recording."""
return {
"serializer": "yaml",
"cassette_library_dir": str(CASSETTES_DIR),
"record_mode": "once",
"match_on": ["uri", "method"],
"filter_headers": ["user-agent", "accept-encoding"],
"decode_compressed_response": True,
}
@pytest.fixture
async def mcp_client():
"""Create an MCP client connected to the server."""
async with Client(mcp) as client:
yield client
@pytest.fixture
def cassette_dir():
"""Return the cassettes directory path."""
return CASSETTES_DIR
# Sample test data fixtures
@pytest.fixture
def sample_ico():
"""Sample company IČO for testing."""
return "46792511"
@pytest.fixture
def sample_company_id():
"""Sample accounting unit ID for testing."""
return 1217556
@pytest.fixture
def sample_closure_id():
"""Sample accounting closure ID for testing."""
return 6028050
@pytest.fixture
def sample_report_id():
"""Sample financial report ID for testing."""
return 9166748
@pytest.fixture
def sample_template_id():
"""Sample template ID for testing."""
return 687