From 8cd822823f73693cb5deac16eea224800b56e62b Mon Sep 17 00:00:00 2001 From: tduhamel42 Date: Fri, 14 Nov 2025 11:14:49 +0100 Subject: [PATCH] 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"). --- backend/tests/unit/test_modules/test_atheris_fuzzer.py | 9 +++++++++ backend/tests/unit/test_modules/test_cargo_fuzzer.py | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/backend/tests/unit/test_modules/test_atheris_fuzzer.py b/backend/tests/unit/test_modules/test_atheris_fuzzer.py index 9cd01ce..0efcc76 100644 --- a/backend/tests/unit/test_modules/test_atheris_fuzzer.py +++ b/backend/tests/unit/test_modules/test_atheris_fuzzer.py @@ -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", diff --git a/backend/tests/unit/test_modules/test_cargo_fuzzer.py b/backend/tests/unit/test_modules/test_cargo_fuzzer.py index f550b9a..5b79ad7 100644 --- a/backend/tests/unit/test_modules/test_cargo_fuzzer.py +++ b/backend/tests/unit/test_modules/test_cargo_fuzzer.py @@ -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"} )