test: Update fuzzer tests to use new create_finding signature

Fixed failing unit tests that were using the old create_finding() signature.
The native findings format refactoring added two new required parameters:
- rule_id: Identifier for the rule/pattern that detected the finding
- found_by: FoundBy object with module, tool, and detection type info

Updated tests:
- test_cargo_fuzzer.py::test_create_finding_from_crash
- test_atheris_fuzzer.py::test_create_crash_finding

Both tests now properly instantiate FoundBy objects with appropriate
fuzzer metadata (module name, tool name, version, and type="fuzzer").
This commit is contained in:
tduhamel42
2025-11-14 11:14:49 +01:00
parent 9488ccf8f1
commit 8cd822823f
2 changed files with 18 additions and 0 deletions

View File

@@ -159,11 +159,20 @@ class TestAtherisFuzzerFindingGeneration:
async def test_create_crash_finding(self, atheris_fuzzer):
"""Test crash finding creation"""
from models.finding_schema import FoundBy
finding = atheris_fuzzer.create_finding(
rule_id="atheris-crash",
title="Crash: Exception in TestOneInput",
description="IndexError: list index out of range",
severity="high",
category="crash",
found_by=FoundBy(
module="atheris_fuzzer",
tool_name="Atheris",
tool_version="2.3.0",
type="fuzzer"
),
file_path="fuzz_target.py",
metadata={
"crash_type": "IndexError",

View File

@@ -161,11 +161,20 @@ class TestCargoFuzzerFindingGeneration:
async def test_create_finding_from_crash(self, cargo_fuzzer):
"""Test finding creation"""
from models.finding_schema import FoundBy
finding = cargo_fuzzer.create_finding(
rule_id="cargo-fuzz-crash",
title="Crash: Segmentation Fault",
description="Test crash",
severity="critical",
category="crash",
found_by=FoundBy(
module="cargo_fuzz",
tool_name="cargo-fuzz",
tool_version="0.11.2",
type="fuzzer"
),
file_path="fuzz/fuzz_targets/fuzz_target_1.rs",
metadata={"crash_type": "SIGSEGV"}
)