feat: add unit tests for report_generator.py (JSON, CSV, PDF, HTML)#85
Merged
Conversation
17 tasks
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #85 +/- ##
=======================================
Coverage ? 40.47%
=======================================
Files ? 16
Lines ? 1905
Branches ? 0
=======================================
Hits ? 771
Misses ? 1134
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
advaitpatel
approved these changes
May 18, 2026
Collaborator
advaitpatel
left a comment
There was a problem hiding this comment.
lgtm. thank you for your contributions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds comprehensive pytest coverage for
report_generator.pyacross all4 supported output formats, closing issue #43.
Changes Made
tests/test_report_generator.py(new)14 tests covering all formats:
JSON (4 tests)
CSV (4 tests)
PDF (3 tests)
HTML (3 tests)
tests/conftest.py(updated)Added two reusable fixtures:
sample_vulnerabilitiessample_scan_infodocksec/report_generator.py(bug fixes discovered during testing)fpdf2cursor positioning crash — allmulti_cell()callsnow use
new_x="LMARGIN", new_y="NEXT"as required by fpdf2 v2.8.7+docksec/config.py(bug fix discovered during testing)langchain_coreimport intry/exceptto preventpydantic_coreimport crash when AI features are not in useValidation
pytest tests/test_report_generator.py -v

→ 14 passed, 0 failures
Closes #43