Skip to content

Commit c737b5a

Browse files
committed
Fix tests
Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
1 parent 129afa7 commit c737b5a

4 files changed

Lines changed: 8 additions & 17 deletions

File tree

vulnerabilities/admin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
Package,
3030
Vulnerability,
3131
VulnerabilityReference,
32-
VulnerabilitySeverity
32+
VulnerabilitySeverity,
3333
)
3434

3535

@@ -57,6 +57,7 @@ class PackageRelatedVulnerabilityAdmin(admin.ModelAdmin):
5757
class ImporterAdmin(admin.ModelAdmin):
5858
pass
5959

60+
6061
@admin.register(VulnerabilitySeverity)
6162
class VulnerabilitySeverityAdmin(admin.ModelAdmin):
6263
pass

vulnerabilities/severity_systems.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def as_score(self, value):
3434
identifier="cvssv2_vector",
3535
name="CVSSv2 Vector",
3636
url="https://www.first.org/cvss/v2/",
37-
notes="cvssv2 vector, used to get additional info about nature and severity of vulnerability",
37+
notes="cvssv2 vector, used to get additional info about nature and severity of vulnerability", # nopep8
3838
),
3939
"cvssv3": ScoringSystem(
4040
identifier="cvssv3",
@@ -46,7 +46,7 @@ def as_score(self, value):
4646
identifier="cvssv3_vector",
4747
name="CVSSv3 Vector",
4848
url="https://www.first.org/cvss/v3-0/",
49-
notes="cvssv3 vector, used to get additional info about nature and severity of vulnerability",
49+
notes="cvssv3 vector, used to get additional info about nature and severity of vulnerability", # nopep8
5050
),
5151
"rhbs": ScoringSystem(
5252
identifier="rhbs",

vulnerabilities/tests/test_nvd.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from vulnerabilities.data_source import Reference
3030
from vulnerabilities.data_source import Advisory
3131
from vulnerabilities.data_source import VulnerabilitySeverity
32-
from vulnerabilities.severity_systems import ScoringSystem
32+
from vulnerabilities.severity_systems import scoring_systems
3333

3434
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
3535
TEST_DATA = os.path.join(BASE_DIR, "test_data/nvd/nvd_test.json")
@@ -149,21 +149,11 @@ def test_to_advisories(self):
149149
url="https://nvd.nist.gov/vuln/detail/CVE-2005-4895",
150150
severities=[
151151
VulnerabilitySeverity(
152-
system=ScoringSystem(
153-
identifier="cvssv2",
154-
name="CVSSv2 Base Score",
155-
url="https://www.first.org/cvss/v2/",
156-
notes="cvssv2 base score",
157-
),
152+
system=scoring_systems["cvssv2"],
158153
value="5.0",
159154
),
160155
VulnerabilitySeverity(
161-
system=ScoringSystem(
162-
identifier="cvssv2_vector",
163-
name="CVSSv2 Vector",
164-
url="https://www.first.org/cvss/v2/",
165-
notes="cvssv2 vector, used to get additional info about nature and severity of vulnerability",
166-
),
156+
system=scoring_systems["cvssv2_vector"],
167157
value="AV:N/AC:L/Au:N/C:N/I:N/A:P",
168158
),
169159
],

vulnerabilities/tests/test_redhat_importer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def test_to_advisory(self):
103103
),
104104
Reference(
105105
reference_id="",
106-
url="https://access.redhat.com/hydra/rest/securitydata/cve/CVE-2016-9401.json",
106+
url="https://access.redhat.com/hydra/rest/securitydata/cve/CVE-2016-9401.json", # nopep8
107107
severities=[
108108
VulnerabilitySeverity(
109109
system=scoring_systems["cvssv3"],

0 commit comments

Comments
 (0)