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
f8238cde
Commit
f8238cde
authored
Apr 01, 2020
by
Michał Zając
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create Vulnerability serializer
parent
00286b2f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
0 deletions
+47
-0
ee/app/serializers/vulnerability_entity.rb
ee/app/serializers/vulnerability_entity.rb
+17
-0
ee/app/serializers/vulnerability_serializer.rb
ee/app/serializers/vulnerability_serializer.rb
+5
-0
ee/spec/serializers/vulnerability_entity_spec.rb
ee/spec/serializers/vulnerability_entity_spec.rb
+25
-0
No files found.
ee/app/serializers/vulnerability_entity.rb
0 → 100644
View file @
f8238cde
# frozen_string_literal: true
class
VulnerabilityEntity
<
Grape
::
Entity
include
RequestAwareEntity
expose
:id
,
:title
,
:state
,
:severity
,
:confidence
,
:report_type
,
:resolved_on_default_branch
,
:project_default_branch
,
:resolved_by_id
,
:dismissed_by_id
,
:confirmed_by_id
end
ee/app/serializers/vulnerability_serializer.rb
0 → 100644
View file @
f8238cde
# frozen_string_literal: true
class
VulnerabilitySerializer
<
BaseSerializer
entity
VulnerabilityEntity
end
ee/spec/serializers/vulnerability_entity_spec.rb
0 → 100644
View file @
f8238cde
# frozen_string_literal: true
require
'spec_helper'
describe
VulnerabilityEntity
do
let
(
:entity
)
{
described_class
.
new
(
vulnerability
)
}
let
(
:vulnerability
)
{
create
(
:vulnerability
,
project:
project
,
author:
user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
subject
{
entity
.
as_json
}
it
'exposes vulnerability-specific elements'
do
expect
(
subject
).
to
match
(
id:
vulnerability
.
id
,
title:
vulnerability
.
title
,
state:
vulnerability
.
state
,
severity:
vulnerability
.
severity
,
confidence:
vulnerability
.
confidence
,
report_type:
vulnerability
.
report_type
,
resolved_on_default_branch:
vulnerability
.
resolved_on_default_branch
,
project_default_branch:
vulnerability
.
project_default_branch
)
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