Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
bf7b8903
Commit
bf7b8903
authored
Sep 14, 2021
by
Fernando
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add presenter unit tests for feature flag cases
* Update tests
parent
3fc05282
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
8 deletions
+17
-8
ee/spec/presenters/projects/security/configuration_presenter_spec.rb
...senters/projects/security/configuration_presenter_spec.rb
+9
-8
spec/factories/ci/builds.rb
spec/factories/ci/builds.rb
+8
-0
No files found.
ee/spec/presenters/projects/security/configuration_presenter_spec.rb
View file @
bf7b8903
...
...
@@ -98,6 +98,7 @@ RSpec.describe Projects::Security::ConfigurationPresenter do
context
"when coverage fuzzing has run in a pipeline with feature flag off"
do
before
do
stub_feature_flags
(
corpus_management:
false
)
pipeline
=
create
(
:ci_pipeline
,
:auto_devops_source
,
...
...
@@ -105,7 +106,7 @@ RSpec.describe Projects::Security::ConfigurationPresenter do
ref:
project
.
default_branch
,
sha:
project
.
commit
.
sha
)
create
(
:
ee_
ci_build
,
:coverage_fuzzing
,
pipeline:
pipeline
,
status:
'success'
)
create
(
:ci_build
,
:coverage_fuzzing
,
pipeline:
pipeline
,
status:
'success'
)
end
it
'reports that coverage fuzzing, corpus management, and DAST are configured'
do
...
...
@@ -117,7 +118,7 @@ RSpec.describe Projects::Security::ConfigurationPresenter do
security_scan
(
:dependency_scanning
,
configured:
false
),
security_scan
(
:license_scanning
,
configured:
false
),
security_scan
(
:secret_detection
,
configured:
false
),
security_scan
(
:coverage_fuzzing
,
configured:
fals
e
),
security_scan
(
:coverage_fuzzing
,
configured:
tru
e
),
security_scan
(
:api_fuzzing
,
configured:
false
),
security_scan
(
:dast_profiles
,
configured:
true
),
security_scan
(
:corpus_management
,
configured:
true
)
...
...
@@ -135,7 +136,7 @@ RSpec.describe Projects::Security::ConfigurationPresenter do
ref:
project
.
default_branch
,
sha:
project
.
commit
.
sha
)
create
(
:
ee_
ci_build
,
:coverage_fuzzing
,
pipeline:
pipeline
,
status:
'success'
)
create
(
:ci_build
,
:coverage_fuzzing
,
pipeline:
pipeline
,
status:
'success'
)
end
it
'reports that coverage fuzzing, corpus management, and DAST are configured'
do
...
...
@@ -147,10 +148,10 @@ RSpec.describe Projects::Security::ConfigurationPresenter do
security_scan
(
:dependency_scanning
,
configured:
false
),
security_scan
(
:license_scanning
,
configured:
false
),
security_scan
(
:secret_detection
,
configured:
false
),
security_scan
(
:coverage_fuzzing
,
configured:
fals
e
),
security_scan
(
:coverage_fuzzing
,
configured:
tru
e
),
security_scan
(
:api_fuzzing
,
configured:
false
),
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
...
...
@@ -305,13 +306,13 @@ RSpec.describe Projects::Security::ConfigurationPresenter do
end
end
def
security_scan
(
type
,
configured
:)
configuration_path
=
configuration_path
(
type
)
def
security_scan
(
type
,
configured
:
,
configuration_path:
nil
)
path
=
configuration_path
||
configuration_path
(
type
)
{
"type"
=>
type
.
to_s
,
"configured"
=>
configured
,
"configuration_path"
=>
configuration_
path
,
"configuration_path"
=>
path
,
"available"
=>
licensed_scan_types
.
include?
(
type
)
}
end
...
...
spec/factories/ci/builds.rb
View file @
bf7b8903
...
...
@@ -534,6 +534,14 @@ FactoryBot.define do
end
end
trait
:coverage_fuzzing
do
options
do
{
artifacts:
{
reports:
{
coverage_fuzzing:
'gl-coverage-fuzzing-report.json'
}
}
}
end
end
trait
:license_scanning
do
options
do
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment