Skip to content

test : add explicit None input test for scanner normalize_severity #1708

Description

@tmdeveloper007

Summary of What Needs to be Done:

Add an explicit unit test for BaseScanner.normalize_severity handling None input in backend/secuscan/scanners/base.py. The existing test_non_string_input test covers numeric input (123) but does not explicitly test None. The current behavior converts None via str(None) which produces "None" — not a known severity key — so the function returns "info". This should be made explicit.

Changes that Need to be Made:

In testing/backend/unit/test_scanners_base.py, add a new test method inside the existing TestNormalizeSeverity class:

def test_none_input_returns_info(self):
    scanner = _ConcreteScanner("task_none", None)
    assert scanner.normalize_severity(None) == "info"

Or as a standalone test function:

def test_normalize_severity_none_input():
    scanner = _ConcreteScanner("task_none", None)
    assert scanner.normalize_severity(None) == "info"

The _ConcreteScanner helper class is already defined in the test file. Import BaseScanner from backend.secuscan.scanners.base.

Impact that it would Provide:

  • Clarity: None is a common input in real pipelines and the expectation should be documented explicitly
  • Regression safety: ensures the str(None) behavior does not accidentally change

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions