Skip to content

test: Improve Tests for nvd_api.py file #4877

Description

@JigyasuRajput

Description

Several functions in cve_bin_tool/nvd_api.py lack proper test coverage.
~~ report

Affected Functions

  • nvd_count_metadata (async, staticmethod)
  • convert_date_to_nvd_date_api2 (staticmethod)
  • get_reject_count_api2 (staticmethod)
  • get_nvd_params (async)
  • validate_nvd_api (async)
  • load_nvd_request (async)
  • get (async)

Steps to Reproduce

Currently, there are no proper tests ensuring the correctness of these functions.

Expected Behavior

  • Unit tests should be written for each function.
  • Mock API calls where necessary to simulate different scenarios.

Suggested Approach

  • Use pytest and unittest.mock for mocking API responses.
  • For async functions, use pytest-asyncio.
  • Ensure coverage for both success and failure cases.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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