Skip to main content
Glama

mcp-clickhouse

Official
by ClickHouse
test_config_interface.py3.26 kB
import pytest from mcp_clickhouse.mcp_env import ClickHouseConfig def test_interface_http_when_secure_false(monkeypatch: pytest.MonkeyPatch): """Test that interface is set to 'http' when CLICKHOUSE_SECURE=false.""" monkeypatch.setenv("CLICKHOUSE_HOST", "localhost") monkeypatch.setenv("CLICKHOUSE_USER", "test") monkeypatch.setenv("CLICKHOUSE_PASSWORD", "test") monkeypatch.setenv("CLICKHOUSE_SECURE", "false") monkeypatch.setenv("CLICKHOUSE_PORT", "8123") config = ClickHouseConfig() client_config = config.get_client_config() assert client_config["interface"] == "http" assert client_config["secure"] is False assert client_config["port"] == 8123 def test_interface_https_when_secure_true(monkeypatch: pytest.MonkeyPatch): """Test that interface is set to 'https' when CLICKHOUSE_SECURE=true.""" monkeypatch.setenv("CLICKHOUSE_HOST", "example.com") monkeypatch.setenv("CLICKHOUSE_USER", "test") monkeypatch.setenv("CLICKHOUSE_PASSWORD", "test") monkeypatch.setenv("CLICKHOUSE_SECURE", "true") monkeypatch.setenv("CLICKHOUSE_PORT", "8443") config = ClickHouseConfig() client_config = config.get_client_config() assert client_config["interface"] == "https" assert client_config["secure"] is True assert client_config["port"] == 8443 def test_interface_https_by_default(monkeypatch: pytest.MonkeyPatch): """Test that interface defaults to 'https' when CLICKHOUSE_SECURE is not set.""" monkeypatch.setenv("CLICKHOUSE_HOST", "example.com") monkeypatch.setenv("CLICKHOUSE_USER", "test") monkeypatch.setenv("CLICKHOUSE_PASSWORD", "test") monkeypatch.delenv("CLICKHOUSE_SECURE", raising=False) monkeypatch.delenv("CLICKHOUSE_PORT", raising=False) config = ClickHouseConfig() client_config = config.get_client_config() assert client_config["interface"] == "https" assert client_config["secure"] is True assert client_config["port"] == 8443 def test_interface_http_with_custom_port(monkeypatch: pytest.MonkeyPatch): """Test that interface is 'http' with custom port when CLICKHOUSE_SECURE=false.""" monkeypatch.setenv("CLICKHOUSE_HOST", "localhost") monkeypatch.setenv("CLICKHOUSE_USER", "test") monkeypatch.setenv("CLICKHOUSE_PASSWORD", "test") monkeypatch.setenv("CLICKHOUSE_SECURE", "false") monkeypatch.setenv("CLICKHOUSE_PORT", "9000") config = ClickHouseConfig() client_config = config.get_client_config() assert client_config["interface"] == "http" assert client_config["secure"] is False assert client_config["port"] == 9000 def test_interface_https_with_custom_port(monkeypatch: pytest.MonkeyPatch): """Test that interface is 'https' with custom port when CLICKHOUSE_SECURE=true.""" monkeypatch.setenv("CLICKHOUSE_HOST", "example.com") monkeypatch.setenv("CLICKHOUSE_USER", "test") monkeypatch.setenv("CLICKHOUSE_PASSWORD", "test") monkeypatch.setenv("CLICKHOUSE_SECURE", "true") monkeypatch.setenv("CLICKHOUSE_PORT", "9443") config = ClickHouseConfig() client_config = config.get_client_config() assert client_config["interface"] == "https" assert client_config["secure"] is True assert client_config["port"] == 9443

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ClickHouse/mcp-clickhouse'

If you have feedback or need assistance with the MCP directory API, please join our Discord server