Exemple #1
0
 def test_vulnerability_introduced_in_only(self):
     v = Vulnerability(id="1")
     v.add_affected_version(VersionRange(introduced_in="2.0"))
     self.assertFalse(v.applies_to("1.0"))
     self.assertFalse(v.applies_to("1.9"))
     self.assertFalse(v.applies_to("2.0-beta3"))
     self.assertTrue(v.applies_to("2.0"))
     self.assertTrue(v.applies_to("2.1"))
Exemple #2
0
 def test_multiple_ranges(self):
     v = Vulnerability(id="1")
     v.add_affected_version(
         VersionRange(introduced_in="1.0", fixed_in="1.2"))
     v.add_affected_version(
         VersionRange(introduced_in="2.0", fixed_in="2.3"))
     v.add_affected_version(
         VersionRange(introduced_in="3.0", fixed_in="3.1"))
     self.assertFalse(v.applies_to("0.9"))
     self.assertTrue(v.applies_to("2.1"))
     self.assertTrue(v.applies_to("3.0"))
     self.assertFalse(v.applies_to("3.1"))
Exemple #3
0
 def test_vulnerability_fixed_in_only(self):
     v = Vulnerability(id="1")
     v.add_affected_version(VersionRange(fixed_in="1.0"))
     self.assertFalse(v.applies_to("1.1"))
     self.assertFalse(v.applies_to("1.0"))
     self.assertTrue(v.applies_to("0.9"))
Exemple #4
0
 def test_vulnerability_has_no_applicable_ranges(self):
     v = Vulnerability(id="1")
     self.assertTrue(v.applies_to("1.0"))