test: update GetAllFindings test to match filtering behavior
GetAllFindings now filters out info/watch severity findings, only returning critical and warning. Update test expectation from 3 findings to 2.
This commit is contained in:
parent
547fb65e39
commit
0ed453c1aa
1 changed files with 4 additions and 5 deletions
|
|
@ -863,6 +863,7 @@ func TestPatrolService_GetAllFindings(t *testing.T) {
|
||||||
ps := NewPatrolService(nil, nil)
|
ps := NewPatrolService(nil, nil)
|
||||||
|
|
||||||
// Add findings with different severities
|
// Add findings with different severities
|
||||||
|
// Note: GetAllFindings now filters out info/watch findings (only returns warning+)
|
||||||
ps.findings.Add(&Finding{
|
ps.findings.Add(&Finding{
|
||||||
ID: "f1",
|
ID: "f1",
|
||||||
Severity: FindingSeverityInfo,
|
Severity: FindingSeverityInfo,
|
||||||
|
|
@ -884,8 +885,9 @@ func TestPatrolService_GetAllFindings(t *testing.T) {
|
||||||
|
|
||||||
findings := ps.GetAllFindings()
|
findings := ps.GetAllFindings()
|
||||||
|
|
||||||
if len(findings) != 3 {
|
// GetAllFindings filters out info/watch - only returns critical and warning
|
||||||
t.Fatalf("Expected 3 findings, got %d", len(findings))
|
if len(findings) != 2 {
|
||||||
|
t.Fatalf("Expected 2 findings (critical+warning only), got %d", len(findings))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should be sorted by severity (critical first)
|
// Should be sorted by severity (critical first)
|
||||||
|
|
@ -895,9 +897,6 @@ func TestPatrolService_GetAllFindings(t *testing.T) {
|
||||||
if findings[1].Severity != FindingSeverityWarning {
|
if findings[1].Severity != FindingSeverityWarning {
|
||||||
t.Errorf("Expected second finding to be warning, got %s", findings[1].Severity)
|
t.Errorf("Expected second finding to be warning, got %s", findings[1].Severity)
|
||||||
}
|
}
|
||||||
if findings[2].Severity != FindingSeverityInfo {
|
|
||||||
t.Errorf("Expected third finding to be info, got %s", findings[2].Severity)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPatrolService_GetFindingsHistory(t *testing.T) {
|
func TestPatrolService_GetFindingsHistory(t *testing.T) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue