"""{{ display_name }} MCP server — generated by mcpify. Do not hand-edit.

Monkeypatches `ApiClient.execute` rather than issuing a real HTTP request
— `tests/integration/test_call_pipeline.py` covers the real HTTP dispatch
path; this test only exercises `call_operation`'s own validate -> execute
-> validate wiring. Uses an operationId `generated_schemas.json` never
declares, so it exercises the validator's always-valid fallback rather
than any spec-dependent schema content.
"""

from __future__ import annotations

import pytest

import {{ module_name }}.tools.call_tool as call_tool_module
from {{ module_name }}.data.store import EndpointRecord


def _endpoint() -> EndpointRecord:
    return EndpointRecord(
        operation_id="__unknown_operation__",
        path="/widgets",
        method="GET",
        summary=None,
        description=None,
        input_schema={},
        output_schema={},
        auth_scheme_ref=None,
    )


async def test_call_operation_returns_the_api_clients_response(
    sample_config, monkeypatch: pytest.MonkeyPatch
) -> None:
    async def fake_execute(self, endpoint, args, auth_manager, request_override=None):
        return {"ok": True}

    monkeypatch.setattr(call_tool_module.ApiClient, "execute", fake_execute)

    result = await call_tool_module.call_operation(
        _endpoint(),
        sample_config,
        auth_manager=None,
        operation_id="__unknown_operation__",
        args={},
    )

    assert result == {"ok": True}
