From f920deda4961dbbbc5ecce16fcbecfff97618bcb Mon Sep 17 00:00:00 2001 From: "John M. Horan" Date: Mon, 14 Aug 2023 17:42:05 -0700 Subject: [PATCH] Move weakness test #1228 Reference: https://github.com/nexB/vulnerablecode/issues/1228 Signed-off-by: John M. Horan --- vulnerabilities/tests/test_models.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/vulnerabilities/tests/test_models.py b/vulnerabilities/tests/test_models.py index fbd0803ff..58ee7cd79 100644 --- a/vulnerabilities/tests/test_models.py +++ b/vulnerabilities/tests/test_models.py @@ -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 @@ -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 @@ -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 ""