Commit 14d117d1 authored by Alex Kalderimis's avatar Alex Kalderimis

Merge branch '291001-finding-vuln-state-inconsistecy' into 'master'

Include `detected`  state vulnerability check for findings

See merge request gitlab-org/gitlab!55806
parents a95edad7 1f4de309
...@@ -123,7 +123,7 @@ module Vulnerabilities ...@@ -123,7 +123,7 @@ module Vulnerabilities
def state def state
return 'dismissed' if dismissal_feedback.present? return 'dismissed' if dismissal_feedback.present?
if vulnerability.nil? if vulnerability.nil? || vulnerability.detected?
'detected' 'detected'
elsif vulnerability.resolved? elsif vulnerability.resolved?
'resolved' 'resolved'
......
---
title: Include detected vulnerability in finding state check
merge_request: 55806
author:
type: added
...@@ -655,6 +655,7 @@ RSpec.describe Vulnerabilities::Finding do ...@@ -655,6 +655,7 @@ RSpec.describe Vulnerabilities::Finding do
let(:confirmed_finding) { create(:vulnerabilities_finding, :confirmed) } let(:confirmed_finding) { create(:vulnerabilities_finding, :confirmed) }
let(:resolved_finding) { create(:vulnerabilities_finding, :resolved) } let(:resolved_finding) { create(:vulnerabilities_finding, :resolved) }
let(:dismissed_finding) { create(:vulnerabilities_finding, :dismissed) } let(:dismissed_finding) { create(:vulnerabilities_finding, :dismissed) }
let(:detected_finding) { create(:vulnerabilities_finding, :detected) }
let(:finding_with_issue) { create(:vulnerabilities_finding, :with_issue_feedback) } let(:finding_with_issue) { create(:vulnerabilities_finding, :with_issue_feedback) }
it 'returns the expected state for a unresolved finding' do it 'returns the expected state for a unresolved finding' do
...@@ -673,6 +674,10 @@ RSpec.describe Vulnerabilities::Finding do ...@@ -673,6 +674,10 @@ RSpec.describe Vulnerabilities::Finding do
expect(dismissed_finding.state).to eq 'dismissed' expect(dismissed_finding.state).to eq 'dismissed'
end end
it 'returns the expected state for a detected finding' do
expect(detected_finding.state).to eq 'detected'
end
context 'when a vulnerability present for a dismissed finding' do context 'when a vulnerability present for a dismissed finding' do
before do before do
create(:vulnerability, project: dismissed_finding.project, findings: [dismissed_finding]) create(:vulnerability, project: dismissed_finding.project, findings: [dismissed_finding])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment