Files
AegisGitea-MCP/tests/test_cli.py
T
Latte c9e2c481e7 feat: add MCP server core, stdio and streamable HTTP transports and serve command
Low-level SDK server built from the catalog plus gitea_api_request, with TOOLSETS/READ_ONLY/DISABLED_TOOLS filters, schema validation without value echo, one audit event per call, static bearer verifier, identity resolver hook, /health, DNS-rebinding protection, rate limiting and fail-closed startup checks.
2026-10-14 16:13:11 +02:00

36 lines
1.1 KiB
Python

"""Tests for the command line skeleton."""
from __future__ import annotations
from pathlib import Path
import pytest
from aegis_gitea_mcp import __version__
from aegis_gitea_mcp.cli import build_parser, main
from tests.test_server_helpers import ANY_HOST
def test_version_prints_package_version(capsys: pytest.CaptureFixture[str]) -> None:
assert main(["version"]) == 0
assert capsys.readouterr().out.strip() == __version__
def test_serve_parses_host_and_port() -> None:
args = build_parser().parse_args(["serve", "--host", ANY_HOST, "--port", "9000"])
assert (args.host, args.port) == (ANY_HOST, 9000)
def test_serve_transport_choices() -> None:
parser = build_parser()
assert parser.parse_args(["serve", "--transport", "stdio"]).transport == "stdio"
with pytest.raises(SystemExit):
parser.parse_args(["serve", "--transport", "sse"])
def test_package_version_matches_pyproject() -> None:
tomllib = pytest.importorskip("tomllib") # Python 3.11+
data = tomllib.loads((Path(__file__).parent.parent / "pyproject.toml").read_text())
assert data["project"]["version"] == __version__