"""Pytest configuration and fixtures for Siigo MCP tests."""
import os
import pytest
@pytest.fixture
def dry_run_env(monkeypatch):
"""Enable dry-run mode - mutations are logged but not executed."""
monkeypatch.setenv("DRY_RUN", "true")
@pytest.fixture
def real_credentials():
"""Load real Siigo credentials from environment.
Requires: SIIGO_USERNAME, SIIGO_ACCESS_KEY, SIIGO_PARTNER_ID
"""
username = os.environ.get("SIIGO_USERNAME")
access_key = os.environ.get("SIIGO_ACCESS_KEY")
partner_id = os.environ.get("SIIGO_PARTNER_ID")
if not all([username, access_key, partner_id]):
pytest.skip("Missing Siigo credentials (SIIGO_USERNAME, SIIGO_ACCESS_KEY, SIIGO_PARTNER_ID)")
return {
"username": username,
"access_key": access_key,
"partner_id": partner_id,
}
@pytest.fixture
async def siigo_client(real_credentials):
"""Get a real Siigo client for read-only tests."""
from siigo_mcp.client import SiigoClient
client = SiigoClient(**real_credentials)
yield client
await client.close()
@pytest.fixture
async def dry_run_client(real_credentials, dry_run_env):
"""Get a dry-run Siigo client - mutations are mocked."""
from siigo_mcp.client import DryRunSiigoClient
client = DryRunSiigoClient(**real_credentials)
yield client
await client.close()