Commit c5dfc913 authored by charlie ablett's avatar charlie ablett

Merge branch 'replace_nil_path_in_scanned_resources_csv_path_223673' into 'master'

Add scanned_resources CSV path to Security Report Summary

See merge request gitlab-org/gitlab!36810
parents feb51cbe b9ba828c
...@@ -31,11 +31,18 @@ module Security ...@@ -31,11 +31,18 @@ module Security
when :scanned_resources when :scanned_resources
response[:scanned_resources] = scanned_resources[report_type.to_s] response[:scanned_resources] = scanned_resources[report_type.to_s]
when :scanned_resources_csv_path when :scanned_resources_csv_path
nil response[:scanned_resources_csv_path] = csv_path
end end
end end
end end
def csv_path
::Gitlab::Routing.url_helpers.project_security_scanned_resources_path(
@pipeline.project,
format: :csv,
pipeline_id: @pipeline.id)
end
def requested_report_types(summary_type) def requested_report_types(summary_type)
@report_types_for_summary_type ||= Gitlab::Utils.multiple_key_invert(@selection_information) @report_types_for_summary_type ||= Gitlab::Utils.multiple_key_invert(@selection_information)
@report_types_for_summary_type[summary_type].map(&:to_s) @report_types_for_summary_type[summary_type].map(&:to_s)
......
---
title: Add scanned_resources CSV path to Security Report Summary
merge_request: 36810
author:
type: added
...@@ -102,8 +102,14 @@ RSpec.describe Security::ReportSummaryService, '#execute' do ...@@ -102,8 +102,14 @@ RSpec.describe Security::ReportSummaryService, '#execute' do
expect(result[:dast][:scanned_resources].length).to eq(20) expect(result[:dast][:scanned_resources].length).to eq(20)
end end
it 'returns the scanned_resources_csv_path as nil' do it 'returns the scanned_resources_csv_path' do
expect(result[:dast][:scanned_resources_csv_path]).to be_nil expected_path = Gitlab::Routing.url_helpers.project_security_scanned_resources_path(
project,
format: :csv,
pipeline_id: pipeline.id
)
expect(result[:dast][:scanned_resources_csv_path]).to eq(expected_path)
end end
context 'When no security scans ran' do context 'When no security scans ran' do
......
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