Skip to content

test: Imporve Test Coverage for fetch_json_db.py #4876

Open
@JigyasuRajput

Description

@JigyasuRajput

Description:

The following functions in cve_bin_tool/fetch_json_db.py lack proper test coverage and need unit tests to ensure reliability:

Functions Needing Tests:

~~ report

  1. get_failed_downloads(self)

    • Ensures missing JSON files are correctly identified and logged.
  2. verify_signature(self)

    • Tests GPG key import failures, invalid/missing signatures, and successful verification.
  3. cleanup_directory(self)

    • Ensures temporary files and directories are properly removed.
  4. handle_download(self) (Partial)

    • Handling unsigned mirror data (not self.is_signed).
    • Signature verification failure (verify_signature).
    • Retrying failed downloads and handling max retry conditions.

Suggested Actions:

  • Mock file system interactions (Path.exists, shutil.rmtree, unlink).
  • Mock GPG signature verification (gnupg.GPG).
  • Simulate failed/missing downloads and retry behavior.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions