Verifies the Gitea instance, token and scopes, registers or reuses the aegis-gitea-mcp OAuth app, generates missing secrets and writes a 0600 env file from the template. Prints client configs and deployment snippets without any secret value.
38 lines
1.2 KiB
Python
38 lines
1.2 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
|
|
|
|
|
|
def test_version_prints_package_version(capsys: pytest.CaptureFixture[str]) -> None:
|
|
assert main(["version"]) == 0
|
|
assert capsys.readouterr().out.strip() == __version__
|
|
|
|
|
|
@pytest.mark.parametrize("argv", [[], ["serve"], ["serve", "--transport", "http"]])
|
|
def test_unbuilt_commands_exit_2(argv: list[str], capsys: pytest.CaptureFixture[str]) -> None:
|
|
assert main(argv) == 2
|
|
captured = capsys.readouterr()
|
|
assert "not implemented yet" in captured.err
|
|
assert captured.out == ""
|
|
|
|
|
|
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__
|