Standardize matching test files structure, add test_main.py and test_commands.py, and update GEMINI.md
This commit is contained in:
18
tests/test_main.py
Normal file
18
tests/test_main.py
Normal file
@@ -0,0 +1,18 @@
|
||||
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
|
||||
Reference in New Issue
Block a user