Skip to content

Failing NVD API tests #1315

@BreadGenie

Description

@BreadGenie

the log from CI

________________________ TestNVD_API.test_api_cve_count ________________________
[gw0] linux -- Python 3.6.14 /opt/hostedtoolcache/Python/3.6.14/x64/bin/python

self = <test.test_nvd_api.TestNVD_API object at 0x7f6140fe4ac8>

    @pytest.mark.asyncio
    async def test_api_cve_count(self):
        """Test to match the totalResults and the total CVE count on NVD"""
    
        connector = aiohttp.TCPConnector()
        async with aiohttp.ClientSession(
            connector=connector, trust_env=True
        ) as session:
    
            status_count = dict()
            async with await session.get(
                "https://nvd.nist.gov/rest/public/dashboard/statistics?reporttype=countsbystatus"
            ) as response:
                # Fetch the rejected and received CVE count from NVD
                response.raise_for_status()
                data = await response.json()
                for dictionary in data["vulnsByStatusCounts"]:
                    status_count[dictionary["name"]] = int(dictionary["count"])
    
        nvd_api = NVD_API(outdir=self.outdir)
        await nvd_api.get_nvd_params()
    
>       assert (
            abs(
                nvd_api.total_results
                - (status_count["Total"] - status_count["Rejected"])
            )
            <= status_count["Received"]
        )
E       KeyError: 'Received'

test/test_nvd_api.py:85: KeyError

Run: https://github.com/intel/cve-bin-tool/runs/3237706256?check_suite_focus=true

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