Files
gitea-codex/tests/test_commands.py
Space-Banane 08075cb3c4
All checks were successful
ci / test (pull_request) Successful in 32s
ci / publish (pull_request) Has been skipped
[fix]. Restore PR-scoped review + remove fix cmd
2026-05-23 14:15:00 +02:00

52 lines
1.5 KiB
Python

from gitea_codex_bot.services.commands import parse_command
def test_parse_review_command_modes() -> None:
cmd = parse_command("@codex review security --full")
assert cmd is not None
assert cmd.name == "review"
assert cmd.mode == "security"
assert cmd.full is True
assert cmd.mode_explicit is True
def test_parse_review_command_defaults_to_non_explicit_summary_mode() -> None:
cmd = parse_command("@codex review")
assert cmd is not None
assert cmd.mode == "summary"
assert cmd.mode_explicit is False
def test_parse_fix_command_returns_none() -> None:
assert parse_command("@codex fix --branch finding 2") is None
def test_invalid_command_returns_none() -> None:
assert parse_command("hello") is None
def test_parse_review_command_for_bot_username_alias() -> None:
cmd = parse_command("@codex-bot review", aliases={"codex", "codex-bot"})
assert cmd is not None
assert cmd.name == "review"
def test_parse_review_command_for_custom_alias() -> None:
cmd = parse_command("@review-buddy review tests", aliases={"codex", "review-buddy"})
assert cmd is not None
assert cmd.name == "review"
assert cmd.mode == "tests"
def test_parse_help_short_flag() -> None:
cmd = parse_command("@codex -h")
assert cmd is not None
assert cmd.name == "help"
def test_parse_help_long_flag_and_arguments() -> None:
cmd = parse_command("@codex --help status quick", aliases={"codex"})
assert cmd is not None
assert cmd.name == "help"
assert cmd.arguments == ["status", "quick"]