diff options
Diffstat (limited to 'spec/lib/gitlab/ci/reports/security')
-rw-r--r-- | spec/lib/gitlab/ci/reports/security/flag_spec.rb | 6 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/reports/security/reports_spec.rb | 26 |
2 files changed, 32 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/reports/security/flag_spec.rb b/spec/lib/gitlab/ci/reports/security/flag_spec.rb index 6ee074f7aeb..0ef8f6c75a0 100644 --- a/spec/lib/gitlab/ci/reports/security/flag_spec.rb +++ b/spec/lib/gitlab/ci/reports/security/flag_spec.rb @@ -29,5 +29,11 @@ RSpec.describe Gitlab::Ci::Reports::Security::Flag do ) end end + + describe '#false_positive?' do + subject { security_flag.false_positive? } + + it { is_expected.to be_truthy } + end end end diff --git a/spec/lib/gitlab/ci/reports/security/reports_spec.rb b/spec/lib/gitlab/ci/reports/security/reports_spec.rb index e240edc4a12..33f3317c655 100644 --- a/spec/lib/gitlab/ci/reports/security/reports_spec.rb +++ b/spec/lib/gitlab/ci/reports/security/reports_spec.rb @@ -125,6 +125,32 @@ RSpec.describe Gitlab::Ci::Reports::Security::Reports do it { is_expected.to be(false) } end + + context 'when target_reports is not nil and reports is empty' do + let(:without_reports) { described_class.new(pipeline) } + + subject { without_reports.violates_default_policy_against?(target_reports, vulnerabilities_allowed, severity_levels, vulnerability_states) } + + before do + target_reports.get_report('sast', artifact).add_finding(high_severity_dast) + end + + context 'when require_approval_on_scan_removal feature is enabled' do + before do + stub_feature_flags(require_approval_on_scan_removal: true) + end + + it { is_expected.to be(true) } + end + + context 'when require_approval_on_scan_removal feature is disabled' do + before do + stub_feature_flags(require_approval_on_scan_removal: false) + end + + it { is_expected.to be(false) } + end + end end end end |