Update GEMINI.md with Vim folding mandate and add test cases for set-flag-format CLI command
This commit is contained in:
@@ -295,3 +295,29 @@ def test_forensics_flag_detect_cli_not_found():
|
||||
result = runner.invoke(forensics_group, ["flag-detect", str(test_file)])
|
||||
assert result.exit_code == 0
|
||||
assert "No flag patterns found" in result.output
|
||||
|
||||
def test_set_flag_format_cli():
|
||||
"""
|
||||
Verifies that 'set-flag-format' CLI command writes the pattern to config.toml.
|
||||
"""
|
||||
from ctf.commands import set_flag_format
|
||||
from ctf.utils import load_config
|
||||
|
||||
runner = CliRunner()
|
||||
config_file = Path("/home/venus/code/ctf/config.toml")
|
||||
|
||||
# Save the original config to restore later
|
||||
original_config = load_config(str(config_file))
|
||||
|
||||
try:
|
||||
result = runner.invoke(set_flag_format, ["TEST_FLAG{[a-z]+}"])
|
||||
assert result.exit_code == 0
|
||||
assert "Flag format set to" in result.output
|
||||
|
||||
# Verify it was written to config.toml
|
||||
updated_config = load_config(str(config_file))
|
||||
assert updated_config["Competition"]["flag_format"] == "TEST_FLAG{[a-z]+}"
|
||||
finally:
|
||||
# Restore original config
|
||||
from ctf.utils import write_config
|
||||
write_config(original_config, str(config_file))
|
||||
|
||||
Reference in New Issue
Block a user