From eb06206e32817b4ff2c805fded4799e9cc93cd9e Mon Sep 17 00:00:00 2001 From: venus Date: Sun, 19 Jul 2026 03:07:27 -0500 Subject: [PATCH] [GEMINI] Fix test_flag_detector_stream_persistence test case --- tests/test_helpers.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 8e16331..2894e18 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -86,21 +86,15 @@ def test_flag_detector_stream_persistence(): """ from io import StringIO from ctf.helpers import FlagDetectorStream - from ctf.config import load_config, write_config + from ctf.config import Config - config_file = Path("/home/venus/code/ctf/config.toml") - original_config = load_config(str(config_file)) + out = StringIO() + stream = FlagDetectorStream(out, r"flag\{[a-z_]+\}") + stream.write("found flag{persisted_flag} in stdout") - try: - out = StringIO() - stream = FlagDetectorStream(out, r"flag\{[a-z_]+\}") - stream.write("found flag{persisted_flag} in stdout") - - # Reload config and check last_flag - updated_config = load_config(str(config_file)) - assert updated_config.get("Competition", {}).get("last_flag") == "flag{persisted_flag}" - finally: - write_config(original_config, str(config_file)) + # Reload config and check last_flag + cfg = Config() + assert cfg.data.get("Competition", {}).get("last_flag") == "flag{persisted_flag}" # }}}