MCPcopy Index your code
hub / github.com/aboutcode-org/vulnerablecode / vulnerability

Function vulnerability

vulnerabilities/tests/test_risk.py:27–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25
26@pytest.fixture
27def vulnerability():
28 vul = Vulnerability(vulnerability_id="VCID-Existing")
29 vul.save()
30
31 severity1 = VulnerabilitySeverity.objects.create(
32 url="https://nvd.nist.gov/vuln/detail/CVE-xxxx-xxx1",
33 scoring_system=CVSSV3.identifier,
34 scoring_elements="CVSS:3.0/AV:P/AC:H/PR:H/UI:R/S:C/C:H/I:H/A:N/E:H/RL:O/RC:R/CR:H/MAC:H/MC:L",
35 value="6.5",
36 )
37
38 severity2 = VulnerabilitySeverity.objects.create(
39 url="https://nvd.nist.gov/vuln/detail/CVE-xxxx-xxx1",
40 scoring_system=GENERIC.identifier,
41 value="MODERATE", # 6.9
42 )
43 vul.severities.add(severity1)
44 vul.severities.add(severity2)
45
46 weaknesses = Weakness.objects.create(cwe_id=119)
47 vul.weaknesses.add(weaknesses)
48 return vul
49
50
51@pytest.fixture

Callers

nothing calls this directly

Calls 4

VulnerabilityClass · 0.90
addMethod · 0.80
saveMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected