Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions test/test_cvedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import datetime
import shutil
import tempfile
from test.utils import LONG_TESTS

import aiohttp
import pytest
Expand All @@ -21,6 +22,9 @@ def teardown_class(cls):
shutil.rmtree(cls.cvedb.cachedir)

@pytest.mark.asyncio
@pytest.mark.skipif(
LONG_TESTS() != 1, reason="Skipping NVD calls due to rate limits"
)
async def test_00_getmeta(self):
connector = aiohttp.TCPConnector(limit_per_host=19)
async with aiohttp.ClientSession(
Expand All @@ -33,6 +37,9 @@ async def test_00_getmeta(self):
assert "sha256" in meta

@pytest.mark.asyncio
@pytest.mark.skipif(
LONG_TESTS() != 1, reason="Skipping NVD calls due to rate limits"
)
async def test_01_nist_scrape(self):
async with aiohttp.ClientSession(trust_env=True) as session:
jsonshas = await self.cvedb.nist_scrape(session)
Expand All @@ -42,6 +49,9 @@ async def test_01_nist_scrape(self):
)

@pytest.mark.asyncio
@pytest.mark.skipif(
LONG_TESTS() != 1, reason="Skipping NVD calls due to rate limits"
)
async def test_02_cache_update(self):
async with aiohttp.ClientSession(trust_env=True) as session:
jsonurl, meta = await self.cvedb.getmeta(
Expand All @@ -51,6 +61,9 @@ async def test_02_cache_update(self):
await self.cvedb.cache_update(session, jsonurl, meta["sha256"])

@pytest.mark.asyncio
@pytest.mark.skipif(
LONG_TESTS() != 1, reason="Skipping NVD calls due to rate limits"
)
async def test_03_refresh(self):
await self.cvedb.refresh()
years = self.cvedb.nvd_years()
Expand Down