Skip to content

test : added unit tests for finding_intelligence confidence and severity helpers#1250

Merged
utksh1 merged 2 commits into
utksh1:mainfrom
tmdeveloper007:#1245
Jun 24, 2026
Merged

test : added unit tests for finding_intelligence confidence and severity helpers#1250
utksh1 merged 2 commits into
utksh1:mainfrom
tmdeveloper007:#1245

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Contributor

Closes #1245.

Summary of What Has Been Done:
Added comprehensive unit tests for 7 pure helper functions in backend/secuscan/finding_intelligence.py: _normalize_severity, _severity_rank, _source_quality, _fingerprint_score, _build_confidence_reason, _compute_confidence, and _sort_sources. Tests cover normal inputs, edge cases (None, empty), and boundary conditions.

Changes Made:

  • Created testing/backend/unit/test_finding_intelligence_confidence.py with 34 test cases organized in pytest classes
  • _normalize_severity: 3 tests (known severities, case insensitivity, unknown defaults)
  • _severity_rank: 3 tests (rank order, unknown defaults, comparability)
  • _source_quality: 5 tests (known sources, max of multiple, unknown defaults, empty, whitespace)
  • _fingerprint_score: 6 tests (all match_strength variants)
  • _build_confidence_reason: 5 tests (reason composition, singular/plural, occurrences, fingerprint)
  • _compute_confidence: 8 tests (valid range, source/evidence/occurrence/validation/severity factors)
  • _sort_sources: 4 tests (dedup, sort, whitespace, empty)

Impact it Made:

  • Prevents regressions in confidence computation logic
  • Documents expected behavior for future contributors
  • Increases overall test coverage of the finding_intelligence module

Note: This task is being handled by tmdeveloper007 -- please assign to that account when picking it up.

@utksh1 utksh1 merged commit f2a67f7 into utksh1:main Jun 24, 2026
@utksh1 utksh1 added the gssoc:approved Admin validation: approved for GSSoC scoring label Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Admin validation: approved for GSSoC scoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test : add unit tests for finding_intelligence confidence and severity helpers

2 participants