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
bf868c7b
Commit
bf868c7b
authored
Apr 14, 2020
by
Jonathan Schafer
Committed by
Mayra Cabrera
Apr 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for vulnerability entity
Update vulnerabiity fixture
parent
caeade42
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
0 deletions
+56
-0
ee/lib/ee/api/entities/vulnerability.rb
ee/lib/ee/api/entities/vulnerability.rb
+2
-0
ee/spec/fixtures/api/schemas/public_api/v4/vulnerability.json
...pec/fixtures/api/schemas/public_api/v4/vulnerability.json
+4
-0
ee/spec/lib/ee/api/entities/vulnerability_spec.rb
ee/spec/lib/ee/api/entities/vulnerability_spec.rb
+50
-0
No files found.
ee/lib/ee/api/entities/vulnerability.rb
View file @
bf868c7b
...
...
@@ -24,6 +24,7 @@ module EE
expose
:last_edited_by_id
expose
:resolved_by_id
expose
:dismissed_by_id
expose
:confirmed_by_id
expose
:start_date
expose
:due_date
...
...
@@ -33,6 +34,7 @@ module EE
expose
:last_edited_at
expose
:resolved_at
expose
:dismissed_at
expose
:confirmed_at
end
end
end
...
...
ee/spec/fixtures/api/schemas/public_api/v4/vulnerability.json
View file @
bf868c7b
...
...
@@ -33,6 +33,8 @@
"updated_by_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"last_edited_by_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"resolved_by_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"dismissed_by_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"confirmed_by_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"closed_by_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"start_date"
:
{
"type"
:
[
"date"
,
"null"
]
},
"due_date"
:
{
"type"
:
[
"date"
,
"null"
]
},
...
...
@@ -40,6 +42,8 @@
"updated_at"
:
{
"type"
:
"date"
},
"last_edited_at"
:
{
"type"
:
"date"
},
"resolved_at"
:
{
"type"
:
"date"
},
"dismissed_at"
:
{
"type"
:
"date"
},
"confirmed_at"
:
{
"type"
:
"date"
},
"closed_at"
:
{
"type"
:
"date"
}
}
}
ee/spec/lib/ee/api/entities/vulnerability_spec.rb
0 → 100644
View file @
bf868c7b
# frozen_string_literal: true
require
'spec_helper'
describe
::
EE
::
API
::
Entities
::
Vulnerability
do
before
do
create_list
(
:vulnerabilities_finding
,
2
,
vulnerability:
vulnerability
)
end
let_it_be
(
:project
)
{
create
(
:project
,
:with_vulnerabilities
)
}
let
(
:vulnerability
)
{
project
.
vulnerabilities
.
first
}
let
(
:entity
)
{
described_class
.
new
(
vulnerability
)}
subject
{
entity
.
as_json
}
it
'contains vulnerability properties'
do
expect
(
subject
[
:id
]).
to
eq
(
vulnerability
.
id
)
expect
(
subject
[
:title
]).
to
eq
(
vulnerability
.
title
)
expect
(
subject
[
:description
]).
to
eq
(
vulnerability
.
description
)
expect
(
subject
[
:state
]).
to
eq
(
vulnerability
.
state
)
expect
(
subject
[
:severity
]).
to
eq
(
vulnerability
.
severity
)
expect
(
subject
[
:confidence
]).
to
eq
(
vulnerability
.
confidence
)
expect
(
subject
[
:report_type
]).
to
eq
(
vulnerability
.
report_type
)
expect
(
subject
[
:project
][
:id
]).
to
eq
(
vulnerability
.
project_id
)
expect
(
subject
[
:finding
][
'id'
]).
to
eq
(
vulnerability
.
finding_ids
.
last
)
expect
(
subject
[
:resolved_on_default_branch
]).
to
eq
(
vulnerability
.
resolved_on_default_branch
)
expect
(
subject
[
:project_default_branch
]).
to
eq
(
vulnerability
.
project_default_branch
)
expect
(
subject
[
:author_id
]).
to
eq
(
vulnerability
.
author_id
)
expect
(
subject
[
:updated_by_id
]).
to
eq
(
vulnerability
.
updated_by_id
)
expect
(
subject
[
:last_edited_by_id
]).
to
eq
(
vulnerability
.
last_edited_by_id
)
expect
(
subject
[
:resolved_by_id
]).
to
eq
(
vulnerability
.
resolved_by_id
)
expect
(
subject
[
:dismissed_by_id
]).
to
eq
(
vulnerability
.
dismissed_by_id
)
expect
(
subject
[
:confirmed_by_id
]).
to
eq
(
vulnerability
.
confirmed_by_id
)
expect
(
subject
[
:start_date
]).
to
eq
(
vulnerability
.
start_date
)
expect
(
subject
[
:due_date
]).
to
eq
(
vulnerability
.
due_date
)
expect
(
subject
[
:created_at
]).
to
eq
(
vulnerability
.
created_at
)
expect
(
subject
[
:updated_at
]).
to
eq
(
vulnerability
.
updated_at
)
expect
(
subject
[
:last_edited_at
]).
to
eq
(
vulnerability
.
last_edited_at
)
expect
(
subject
[
:resolved_at
]).
to
eq
(
vulnerability
.
resolved_at
)
expect
(
subject
[
:dismissed_at
]).
to
eq
(
vulnerability
.
dismissed_at
)
expect
(
subject
[
:confirmed_at
]).
to
eq
(
vulnerability
.
confirmed_at
)
end
end
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