9
9
10
10
import json
11
11
import os
12
+ import pytest
12
13
from pathlib import Path
13
14
from types import SimpleNamespace
14
15
@@ -39,6 +40,7 @@ def test_package_first_mode_valid_npm_package(tmp_path):
39
40
pipeline = NpmLiveImporterPipeline (purl = purl )
40
41
pipeline .vcs_response = mock_vcs_response
41
42
43
+ pipeline .get_purl_inputs ()
42
44
advisories = list (pipeline .collect_advisories ())
43
45
44
46
assert len (advisories ) == 1
@@ -64,6 +66,7 @@ def test_package_first_mode_unaffected_version(tmp_path):
64
66
pipeline = NpmLiveImporterPipeline (purl = purl )
65
67
pipeline .vcs_response = mock_vcs_response
66
68
69
+ pipeline .get_purl_inputs ()
67
70
advisories = list (pipeline .collect_advisories ())
68
71
69
72
assert len (advisories ) == 0
@@ -79,9 +82,8 @@ def test_package_first_mode_invalid_package_type(tmp_path):
79
82
pipeline = NpmLiveImporterPipeline (purl = purl )
80
83
pipeline .vcs_response = mock_vcs_response
81
84
82
- advisories = list (pipeline .collect_advisories ())
83
-
84
- assert len (advisories ) == 0
85
+ with pytest .raises (ValueError ):
86
+ pipeline .get_purl_inputs ()
85
87
86
88
87
89
def test_package_first_mode_package_not_found (tmp_path ):
@@ -103,6 +105,7 @@ def test_package_first_mode_package_not_found(tmp_path):
103
105
pipeline = NpmLiveImporterPipeline (purl = purl )
104
106
pipeline .vcs_response = mock_vcs_response
105
107
108
+ pipeline .get_purl_inputs ()
106
109
advisories = list (pipeline .collect_advisories ())
107
110
108
111
assert len (advisories ) == 0
@@ -111,6 +114,7 @@ def test_package_first_mode_package_not_found(tmp_path):
111
114
def test_version_is_affected ():
112
115
purl = PackageURL (type = "npm" , name = "npm" , version = "1.2.0" )
113
116
pipeline = NpmLiveImporterPipeline (purl = purl )
117
+ pipeline .get_purl_inputs ()
114
118
115
119
affected_package = AffectedPackage (
116
120
package = PackageURL (type = "npm" , name = "npm" ),
0 commit comments