Skip to content

Commit 303376e

Browse files
authored
fix: enable nvd_api tests and add modEndDate param (#1427)
* fix: enable nvd_api tests and add modEndDate param * enable nvd_api tests in ci * fixes #1422
1 parent b02eddc commit 303376e

File tree

3 files changed

+1
-6
lines changed

3 files changed

+1
-6
lines changed

.github/workflows/pythonapp.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ jobs:
114114
--ignore=test/test_cli.py
115115
--ignore=test/test_cvedb.py
116116
--ignore=test/test_requirements.py
117-
--ignore=test/test_nvd_api.py
118117
- name: Run synchronous tests
119118
run: >
120119
pytest -v
@@ -183,7 +182,6 @@ jobs:
183182
--ignore=test/test_cli.py
184183
--ignore=test/test_cvedb.py
185184
--ignore=test/test_requirements.py
186-
--ignore=test/test_nvd_api.py
187185
- name: Run synchronous tests
188186
run: >
189187
pytest -v --cov --cov-append --cov-report=xml
@@ -255,7 +253,6 @@ jobs:
255253
--ignore=test/test_cvedb.py
256254
--ignore=test/test_requirements.py
257255
--ignore=test/test_helper_script.py
258-
--ignore=test/test_nvd_api.py
259256
- name: Run synchronous tests
260257
run: >
261258
pytest -v

cve_bin_tool/nvd_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ async def get_nvd_params(
102102
self.params["modStartDate"] = self.convert_date_to_nvd_date(
103103
time_of_last_update - timedelta(minutes=2)
104104
)
105+
self.params["modEndDate"] = self.convert_date_to_nvd_date(datetime.now())
105106
self.logger.info(
106107
f'Fetching updated CVE entries after {self.params["modStartDate"]}'
107108
)

test/test_nvd_api.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ def teardown_class(cls):
2121
shutil.rmtree(cls.outdir)
2222

2323
@pytest.mark.asyncio
24-
@pytest.mark.skip(reason="Disabled due to timeouts")
2524
async def test_get_nvd_params(self):
2625
"""Test NVD for a future date. It should be empty"""
2726
nvd_api = NVD_API()
@@ -32,7 +31,6 @@ async def test_get_nvd_params(self):
3231
assert nvd_api.total_results == 0 and nvd_api.all_cve_entries == []
3332

3433
@pytest.mark.asyncio
35-
@pytest.mark.skip(reason="Disabled due to timeouts")
3634
async def test_total_results_count(self):
3735
"""Total results should be greater than or equal to the current fetched cves"""
3836
nvd_api = NVD_API()
@@ -43,7 +41,6 @@ async def test_total_results_count(self):
4341
assert len(nvd_api.all_cve_entries) >= nvd_api.total_results
4442

4543
@pytest.mark.asyncio
46-
@pytest.mark.skip(reason="Disabled due to timeouts")
4744
async def test_nvd_incremental_update(self):
4845
"""Test to check whether we are able to fetch and save the nvd entries using time_of_last_update"""
4946
nvd_api = NVD_API(incremental_update=True)

0 commit comments

Comments
 (0)