Skip to content

Commit 8cd8228

Browse files
committed
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").
1 parent 9488ccf commit 8cd8228

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

backend/tests/unit/test_modules/test_atheris_fuzzer.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,20 @@ class TestAtherisFuzzerFindingGeneration:
159159

160160
async def test_create_crash_finding(self, atheris_fuzzer):
161161
"""Test crash finding creation"""
162+
from models.finding_schema import FoundBy
163+
162164
finding = atheris_fuzzer.create_finding(
165+
rule_id="atheris-crash",
163166
title="Crash: Exception in TestOneInput",
164167
description="IndexError: list index out of range",
165168
severity="high",
166169
category="crash",
170+
found_by=FoundBy(
171+
module="atheris_fuzzer",
172+
tool_name="Atheris",
173+
tool_version="2.3.0",
174+
type="fuzzer"
175+
),
167176
file_path="fuzz_target.py",
168177
metadata={
169178
"crash_type": "IndexError",

backend/tests/unit/test_modules/test_cargo_fuzzer.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,20 @@ class TestCargoFuzzerFindingGeneration:
161161

162162
async def test_create_finding_from_crash(self, cargo_fuzzer):
163163
"""Test finding creation"""
164+
from models.finding_schema import FoundBy
165+
164166
finding = cargo_fuzzer.create_finding(
167+
rule_id="cargo-fuzz-crash",
165168
title="Crash: Segmentation Fault",
166169
description="Test crash",
167170
severity="critical",
168171
category="crash",
172+
found_by=FoundBy(
173+
module="cargo_fuzz",
174+
tool_name="cargo-fuzz",
175+
tool_version="0.11.2",
176+
type="fuzzer"
177+
),
169178
file_path="fuzz/fuzz_targets/fuzz_target_1.rs",
170179
metadata={"crash_type": "SIGSEGV"}
171180
)

0 commit comments

Comments
 (0)