Skip to content

Commit 5267b18

Browse files
committed
Update NPM Live Importer tests #1936
Signed-off-by: Michael Ehab Mikhail <[email protected]>
1 parent 2222126 commit 5267b18

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

vulnerabilities/tests/pipelines/test_npm_live_importer_pipeline_v2.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import json
1111
import os
12+
import pytest
1213
from pathlib import Path
1314
from types import SimpleNamespace
1415

@@ -39,6 +40,7 @@ def test_package_first_mode_valid_npm_package(tmp_path):
3940
pipeline = NpmLiveImporterPipeline(purl=purl)
4041
pipeline.vcs_response = mock_vcs_response
4142

43+
pipeline.get_purl_inputs()
4244
advisories = list(pipeline.collect_advisories())
4345

4446
assert len(advisories) == 1
@@ -64,6 +66,7 @@ def test_package_first_mode_unaffected_version(tmp_path):
6466
pipeline = NpmLiveImporterPipeline(purl=purl)
6567
pipeline.vcs_response = mock_vcs_response
6668

69+
pipeline.get_purl_inputs()
6770
advisories = list(pipeline.collect_advisories())
6871

6972
assert len(advisories) == 0
@@ -79,9 +82,8 @@ def test_package_first_mode_invalid_package_type(tmp_path):
7982
pipeline = NpmLiveImporterPipeline(purl=purl)
8083
pipeline.vcs_response = mock_vcs_response
8184

82-
advisories = list(pipeline.collect_advisories())
83-
84-
assert len(advisories) == 0
85+
with pytest.raises(ValueError):
86+
pipeline.get_purl_inputs()
8587

8688

8789
def test_package_first_mode_package_not_found(tmp_path):
@@ -103,6 +105,7 @@ def test_package_first_mode_package_not_found(tmp_path):
103105
pipeline = NpmLiveImporterPipeline(purl=purl)
104106
pipeline.vcs_response = mock_vcs_response
105107

108+
pipeline.get_purl_inputs()
106109
advisories = list(pipeline.collect_advisories())
107110

108111
assert len(advisories) == 0
@@ -111,6 +114,7 @@ def test_package_first_mode_package_not_found(tmp_path):
111114
def test_version_is_affected():
112115
purl = PackageURL(type="npm", name="npm", version="1.2.0")
113116
pipeline = NpmLiveImporterPipeline(purl=purl)
117+
pipeline.get_purl_inputs()
114118

115119
affected_package = AffectedPackage(
116120
package=PackageURL(type="npm", name="npm"),

0 commit comments

Comments
 (0)