@@ -26,7 +26,9 @@ def test_one_security_issue(self):
26
26
finding = findings [0 ]
27
27
self .assertEqual ("Security Issue - Fingerprint Web Application Framework" , finding .title )
28
28
self .assertEqual ("Info" , finding .severity )
29
- # Expect both endpoints to have the same host as per new JSON
29
+ # Validate endpoints
30
+ for endpoint in finding .unsaved_endpoints :
31
+ endpoint .clean ()
30
32
endpoint_hosts = [e .host for e in finding .unsaved_endpoints ]
31
33
self .assertEqual (2 , len (endpoint_hosts ))
32
34
self .assertTrue (all (host == "host" for host in endpoint_hosts ))
@@ -40,17 +42,19 @@ def test_one_cve(self):
40
42
self .assertEqual (1 , len (findings ))
41
43
42
44
finding = findings [0 ]
43
- # When there are no products, title equals the CVE code
44
45
self .assertEqual ("CVE-2023-42366" , finding .title )
45
46
self .assertEqual ("Medium" , finding .severity )
46
47
self .assertIn ("CVSS Base vector:" , finding .description )
47
48
self .assertIn ("CVE Published At: 2023-11-27T23:15:07.420+01:00" , finding .description )
48
49
self .assertIn ("Exploit Code Maturity: proof_of_concept" , finding .description )
49
- self .assertIn ("EPSS: 0.00044" , finding .description )
50
- # Since there are no updates_assets, mitigation is set to a string starting with "Fixed At:"
51
50
self .assertTrue (finding .mitigation .startswith ("Fixed At:" ))
51
+ self .assertEqual (float (0.00044 ), finding .epss_score )
52
52
self .assertEqual ("Updated At: 2024-12-06T14:15:19.530+01:00" , finding .references )
53
53
self .assertEqual (1 , len (finding .unsaved_endpoints ))
54
+ self .assertEqual (787 , finding .cwe )
55
+ # Validate endpoints
56
+ for endpoint in finding .unsaved_endpoints :
57
+ endpoint .clean ()
54
58
endpoint_hosts = [e .host for e in finding .unsaved_endpoints ]
55
59
self .assertIn ("computer_name" , endpoint_hosts )
56
60
@@ -61,27 +65,32 @@ def test_mixed_findings(self):
61
65
62
66
self .assertEqual (3 , len (findings ))
63
67
64
- # Separate CVEs and Security Issues by title
65
68
cve_findings = [f for f in findings if f .title .startswith ("CVE-" )]
66
69
security_issues = [f for f in findings if f .title .startswith ("Security Issue" )]
67
70
68
71
self .assertEqual (1 , len (cve_findings ))
69
72
self .assertEqual (2 , len (security_issues ))
70
73
71
- # For the CVE finding, check expected properties
72
74
cve_finding = cve_findings [0 ]
73
75
self .assertEqual ("CVE-2023-42366" , cve_finding .title )
74
76
self .assertEqual ("Medium" , cve_finding .severity )
75
77
self .assertIn ("CVE Published At:" , cve_finding .description )
76
78
self .assertIn ("Updated At: 2024-12-06T14:15:19.530+01:00" , cve_finding .references )
77
79
self .assertEqual (1 , len (cve_finding .unsaved_endpoints ))
80
+ self .assertEqual (float (0.00044 ), cve_finding .epss_score )
81
+ self .assertEqual (787 , cve_finding .cwe )
82
+ # Validate endpoints
83
+ for endpoint in cve_finding .unsaved_endpoints :
84
+ endpoint .clean ()
78
85
self .assertIsNone (cve_finding .component_name )
79
86
80
- # For each security issue, check that title and severity are valid and endpoints exist
81
87
for sec_issue in security_issues :
82
88
self .assertTrue (sec_issue .title .startswith ("Security Issue - " ))
83
89
self .assertIn (sec_issue .severity , ["Critical" , "High" , "Medium" , "Low" , "Info" ])
84
90
self .assertTrue (len (sec_issue .unsaved_endpoints ) > 0 )
91
+ # Validate endpoints
92
+ for endpoint in sec_issue .unsaved_endpoints :
93
+ endpoint .clean ()
85
94
self .assertIsNotNone (sec_issue .description )
86
95
self .assertIsNotNone (sec_issue .mitigation )
87
96
self .assertIsNotNone (sec_issue .impact )
0 commit comments