[GEMINI] Add unit tests for is_valid_flag helper
This commit is contained in:
@@ -12,3 +12,20 @@ def test_check_for_flag():
|
||||
assert set(res_custom) == {"custom{first}", "custom{second}"}
|
||||
assert check_for_flag("no flag matches here") == []
|
||||
# }}}
|
||||
|
||||
# {{{ test_is_valid_flag
|
||||
def test_is_valid_flag():
|
||||
"""
|
||||
Verifies that is_valid_flag validates flags and supports uniqueness checks.
|
||||
"""
|
||||
from ctf.helpers import is_valid_flag
|
||||
# Valid flag
|
||||
assert is_valid_flag("flag{test}")
|
||||
# Invalid flag
|
||||
assert not is_valid_flag("no flag here")
|
||||
# Uniqueness check (success)
|
||||
assert is_valid_flag("flag{new}", original="flag{old}")
|
||||
# Uniqueness check (failure)
|
||||
assert not is_valid_flag("flag{same}", original="flag{same}")
|
||||
# }}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user