Skip to content

Commit

Permalink
test: Move NVD queries to LONG_TESTS due to rate limits (#1511)
Browse files Browse the repository at this point in the history
  • Loading branch information
terriko authored Jan 12, 2022
1 parent 8c1f773 commit 91d4560
Showing 1 changed file with 13 additions and 0 deletions.
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

0 comments on commit 91d4560

Please sign in to comment.