diff --git a/tests/test_forensics.py b/tests/test_forensics.py index 548b43f..805f022 100644 --- a/tests/test_forensics.py +++ b/tests/test_forensics.py @@ -267,3 +267,31 @@ def test_forensics_signatures_cli(): assert "Supported Magic Signatures" in result.output assert "PNG Image" in result.output assert "89504E47" in result.output + +def test_forensics_flag_detect_cli_found(): + """ + Verifies that 'forensics flag-detect' successfully finds flag patterns. + """ + runner = CliRunner() + test_file = TEST_ENV / "flag_data.bin" + with open(test_file, "wb") as f: + f.write(b"random_data_here_flag{found_statically_in_file}more_data") + + result = runner.invoke(forensics_group, ["flag-detect", str(test_file)]) + assert result.exit_code == 0 + assert "Potential Flag(s) Found" in result.output + assert "flag{found_statically_in_file}" in result.output + +def test_forensics_flag_detect_cli_not_found(): + """ + Verifies that 'forensics flag-detect' displays 'No flag patterns found.' + when no flag matches the pattern. + """ + runner = CliRunner() + test_file = TEST_ENV / "clean_data.bin" + with open(test_file, "wb") as f: + f.write(b"this is a completely normal text file without flags.") + + result = runner.invoke(forensics_group, ["flag-detect", str(test_file)]) + assert result.exit_code == 0 + assert "No flag patterns found" in result.output