Commit bf7b8903 authored by Fernando's avatar Fernando

Add presenter unit tests for feature flag cases

* Update tests
parent 3fc05282
...@@ -98,6 +98,7 @@ RSpec.describe Projects::Security::ConfigurationPresenter do ...@@ -98,6 +98,7 @@ RSpec.describe Projects::Security::ConfigurationPresenter do
context "when coverage fuzzing has run in a pipeline with feature flag off" do context "when coverage fuzzing has run in a pipeline with feature flag off" do
before do before do
stub_feature_flags(corpus_management: false)
pipeline = create( pipeline = create(
:ci_pipeline, :ci_pipeline,
:auto_devops_source, :auto_devops_source,
...@@ -105,7 +106,7 @@ RSpec.describe Projects::Security::ConfigurationPresenter do ...@@ -105,7 +106,7 @@ RSpec.describe Projects::Security::ConfigurationPresenter do
ref: project.default_branch, ref: project.default_branch,
sha: project.commit.sha sha: project.commit.sha
) )
create(:ee_ci_build, :coverage_fuzzing, pipeline: pipeline, status: 'success') create(:ci_build, :coverage_fuzzing, pipeline: pipeline, status: 'success')
end end
it 'reports that coverage fuzzing, corpus management, and DAST are configured' do it 'reports that coverage fuzzing, corpus management, and DAST are configured' do
...@@ -117,7 +118,7 @@ RSpec.describe Projects::Security::ConfigurationPresenter do ...@@ -117,7 +118,7 @@ RSpec.describe Projects::Security::ConfigurationPresenter do
security_scan(:dependency_scanning, configured: false), security_scan(:dependency_scanning, configured: false),
security_scan(:license_scanning, configured: false), security_scan(:license_scanning, configured: false),
security_scan(:secret_detection, configured: false), security_scan(:secret_detection, configured: false),
security_scan(:coverage_fuzzing, configured: false), security_scan(:coverage_fuzzing, configured: true),
security_scan(:api_fuzzing, configured: false), security_scan(:api_fuzzing, configured: false),
security_scan(:dast_profiles, configured: true), security_scan(:dast_profiles, configured: true),
security_scan(:corpus_management, configured: true) security_scan(:corpus_management, configured: true)
...@@ -135,7 +136,7 @@ RSpec.describe Projects::Security::ConfigurationPresenter do ...@@ -135,7 +136,7 @@ RSpec.describe Projects::Security::ConfigurationPresenter do
ref: project.default_branch, ref: project.default_branch,
sha: project.commit.sha sha: project.commit.sha
) )
create(:ee_ci_build, :coverage_fuzzing, pipeline: pipeline, status: 'success') create(:ci_build, :coverage_fuzzing, pipeline: pipeline, status: 'success')
end end
it 'reports that coverage fuzzing, corpus management, and DAST are configured' do it 'reports that coverage fuzzing, corpus management, and DAST are configured' do
...@@ -147,10 +148,10 @@ RSpec.describe Projects::Security::ConfigurationPresenter do ...@@ -147,10 +148,10 @@ RSpec.describe Projects::Security::ConfigurationPresenter do
security_scan(:dependency_scanning, configured: false), security_scan(:dependency_scanning, configured: false),
security_scan(:license_scanning, configured: false), security_scan(:license_scanning, configured: false),
security_scan(:secret_detection, configured: false), security_scan(:secret_detection, configured: false),
security_scan(:coverage_fuzzing, configured: false), security_scan(:coverage_fuzzing, configured: true),
security_scan(:api_fuzzing, configured: false), security_scan(:api_fuzzing, configured: false),
security_scan(:dast_profiles, configured: true), security_scan(:dast_profiles, configured: true),
security_scan(:corpus_management, configured: true) security_scan(:corpus_management, configured: true, configuration_path: project_security_configuration_corpus_management_path(project))
) )
end end
end end
...@@ -305,13 +306,13 @@ RSpec.describe Projects::Security::ConfigurationPresenter do ...@@ -305,13 +306,13 @@ RSpec.describe Projects::Security::ConfigurationPresenter do
end end
end end
def security_scan(type, configured:) def security_scan(type, configured:, configuration_path: nil)
configuration_path = configuration_path(type) path = configuration_path || configuration_path(type)
{ {
"type" => type.to_s, "type" => type.to_s,
"configured" => configured, "configured" => configured,
"configuration_path" => configuration_path, "configuration_path" => path,
"available" => licensed_scan_types.include?(type) "available" => licensed_scan_types.include?(type)
} }
end end
......
...@@ -534,6 +534,14 @@ FactoryBot.define do ...@@ -534,6 +534,14 @@ FactoryBot.define do
end end
end end
trait :coverage_fuzzing do
options do
{
artifacts: { reports: { coverage_fuzzing: 'gl-coverage-fuzzing-report.json' } }
}
end
end
trait :license_scanning do trait :license_scanning do
options do options 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