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}" # }}}