Skip to content

Commit

Permalink
Move weakness test #1228
Browse files Browse the repository at this point in the history
Reference: #1228

Signed-off-by: John M. Horan <johnmhoran@gmail.com>
  • Loading branch information
johnmhoran committed Aug 15, 2023
1 parent eee1d79 commit f920ded
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions vulnerabilities/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ def test_vulnerability_save_without_vulnerability_id(self):
== 1
)

def test_cwe_not_present_in_weaknesses_db(self):
w1 = models.Weakness.objects.create(name="189")
assert w1.weakness is None
assert w1.name is ""
assert w1.description is ""


# FIXME: The fixture code is duplicated. setUpClass is not working with the pytest mark.
@pytest.mark.django_db
Expand Down Expand Up @@ -190,13 +196,6 @@ def test_get_vulnerable_packages(self):
assert vuln_packages.count() == 3
assert vuln_packages.distinct().count() == 2

# matching_fixed_packages = vulnerablecode_package.get_fixed_packages(vulnerablecode_package)
# assert vuln_packages.distinct()[0]

# matching_fixed_packages = vuln_packages.distinct()[0].get_fixed_packages(
# vuln_packages.distinct()[0]
# )

first_vulnerable_package = vuln_packages.distinct()[0]
matching_fixed_packages = first_vulnerable_package.get_fixed_packages(
first_vulnerable_package
Expand Down Expand Up @@ -400,9 +399,3 @@ def test_string_to_purl_to_dict_to_package(self):
)
assert vulnerablecode_package.qualifiers == {}
assert vulnerablecode_package.subpath == ""

def test_cwe_not_present_in_weaknesses_db(self):
w1 = models.Weakness.objects.create(name="189")
assert w1.weakness is None
assert w1.name is ""
assert w1.description is ""

0 comments on commit f920ded

Please sign in to comment.