Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Imporve Test Coverage for fetch_json_db.py #4876

Open
JigyasuRajput opened this issue Mar 2, 2025 · 1 comment · May be fixed by #4932
Open

test: Imporve Test Coverage for fetch_json_db.py #4876

JigyasuRajput opened this issue Mar 2, 2025 · 1 comment · May be fixed by #4932
Assignees

Comments

@JigyasuRajput
Copy link
Contributor

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.
@JigyasuRajput JigyasuRajput changed the title test: Add Test Coverage for fetch_json_db.py test: Imporve Test Coverage for fetch_json_db.py Mar 2, 2025
@JigyasuRajput
Copy link
Contributor Author

Hey! I'm working on this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant