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
c03aa7d1
Commit
c03aa7d1
authored
Mar 28, 2022
by
Michał Zając
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust remaining specs
parent
e5f0f40b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
8 deletions
+24
-8
ee/spec/lib/ee/gitlab/ci/parsers/security/validators/schema_validator_spec.rb
...b/ci/parsers/security/validators/schema_validator_spec.rb
+24
-8
No files found.
ee/spec/lib/ee/gitlab/ci/parsers/security/validators/schema_validator_spec.rb
View file @
c03aa7d1
...
...
@@ -5,17 +5,17 @@ require 'spec_helper'
RSpec
.
describe
Gitlab
::
Ci
::
Parsers
::
Security
::
Validators
::
SchemaValidator
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:report_type
,
:expected_errors
,
:valid_data
)
do
:cluster_image_scanning
|
[
'root is missing required keys: vulnerabilities'
]
|
{
'version'
=>
'10.0.0'
,
'vulnerabilities'
=>
[]
}
:container_scanning
|
[
'root is missing required keys: vulnerabilities'
]
|
{
'version'
=>
'10.0.0'
,
'vulnerabilities'
=>
[]
}
:coverage_fuzzing
|
[
'root is missing required keys: vulnerabilities'
]
|
{
'version'
=>
'10.0.0'
,
'vulnerabilities'
=>
[]
}
:dast
|
[
'root is missing required keys: vulnerabilities'
]
|
{
'version'
=>
'10.0.0'
,
'vulnerabilities'
=>
[]
}
:dependency_scanning
|
[
'root is missing required keys: dependency_files, vulnerabilities'
]
|
{
'version'
=>
'10.0.0'
,
'vulnerabilities'
=>
[],
'dependency_files'
=>
[]
}
:api_fuzzing
|
[
'root is missing required keys: vulnerabilities'
]
|
{
'version'
=>
'10.0.0'
,
'vulnerabilities'
=>
[]
}
where
(
:report_type
,
:expected_errors
,
:
expected_warnings
,
:
valid_data
)
do
:cluster_image_scanning
|
[
'root is missing required keys: vulnerabilities'
]
|
lazy
{
expected_warnings_array
}
|
{
'version'
=>
'10.0.0'
,
'vulnerabilities'
=>
[]
}
:container_scanning
|
[
'root is missing required keys: vulnerabilities'
]
|
lazy
{
expected_warnings_array
}
|
{
'version'
=>
'10.0.0'
,
'vulnerabilities'
=>
[]
}
:coverage_fuzzing
|
[
'root is missing required keys: vulnerabilities'
]
|
lazy
{
expected_warnings_array
}
|
{
'version'
=>
'10.0.0'
,
'vulnerabilities'
=>
[]
}
:dast
|
[
'root is missing required keys: vulnerabilities'
]
|
lazy
{
expected_warnings_array
}
|
{
'version'
=>
'10.0.0'
,
'vulnerabilities'
=>
[]
}
:dependency_scanning
|
[
'root is missing required keys: dependency_files, vulnerabilities'
]
|
lazy
{
expected_warnings_array
}
|
{
'version'
=>
'10.0.0'
,
'vulnerabilities'
=>
[],
'dependency_files'
=>
[]
}
:api_fuzzing
|
[
'root is missing required keys: vulnerabilities'
]
|
lazy
{
expected_warnings_array
}
|
{
'version'
=>
'10.0.0'
,
'vulnerabilities'
=>
[]
}
end
with_them
do
let
(
:validator
)
{
described_class
.
new
(
report_type
,
report_data
)
}
let
(
:validator
)
{
described_class
.
new
(
report_type
,
report_data
,
valid_data
[
'version'
]
)
}
describe
'#valid?'
do
subject
{
validator
.
valid?
}
...
...
@@ -33,6 +33,22 @@ RSpec.describe Gitlab::Ci::Parsers::Security::Validators::SchemaValidator do
end
end
describe
'#warnings'
do
subject
{
validator
.
warnings
}
context
'when given data is valid according to the schema'
do
let
(
:report_data
)
{
valid_data
}
let
(
:supported_version
)
{
described_class
::
SUPPORTED_VERSIONS
[
report_type
].
join
(
", "
)
}
let
(
:expected_warnings_array
)
do
[
"Version 10.0.0 for report type
#{
report_type
}
has been deprecated, supported versions for this report type are:
#{
supported_version
}
"
]
end
it
{
is_expected
.
to
eq
(
expected_warnings
)
}
end
end
describe
'#errors'
do
let
(
:report_data
)
{
{
'version'
=>
'10.0.0'
}
}
...
...
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