from __future__ import annotations

import pytest

from rabbitmq_mcp.mcp_errors import MCPToolError
from rabbitmq_mcp.registry import get_operation
from rabbitmq_mcp.validation import validate_call


def test_validate_call_missing_path_param() -> None:
    operation = get_operation("queues.get_by_params")
    with pytest.raises(MCPToolError) as excinfo:
        validate_call(operation, path_params={}, query_params=None, body=None)
    assert excinfo.value.code == "MISSING_PATH_PARAM"


def test_validate_call_ignores_path_params_not_in_path() -> None:
    operation = get_operation("vhosts.list")
    validate_call(operation, path_params={}, query_params=None, body=None)
