20 lines
652 B
Python
20 lines
652 B
Python
# tests/test_main.py
|
|
import sys
|
|
import pytest
|
|
from unittest.mock import patch
|
|
from ctf.main import main
|
|
|
|
def test_main_entry_point_help():
|
|
"""
|
|
Verifies that calling main() executes the Click CLI app and responds
|
|
to '--help' by listing registration groups.
|
|
"""
|
|
# Mock sys.argv to simulate running 'ctf --help' from the shell
|
|
with patch.object(sys, "argv", ["ctf", "--help"]):
|
|
# Click calls sys.exit() after displaying help, raising SystemExit
|
|
with pytest.raises(SystemExit) as exc_info:
|
|
main()
|
|
|
|
# Verify it exits with a successful exit code (0)
|
|
assert exc_info.value.code == 0
|