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
839439b8
Commit
839439b8
authored
Oct 07, 2019
by
Victor Zagorodny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add VulnerabilityEntity w/ JSON schema tests
parent
1b5ba11b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
0 deletions
+96
-0
ee/app/serializers/vulnerability_entity.rb
ee/app/serializers/vulnerability_entity.rb
+26
-0
ee/spec/fixtures/api/schemas/vulnerability.json
ee/spec/fixtures/api/schemas/vulnerability.json
+53
-0
ee/spec/serializers/vulnerability_entity_spec.rb
ee/spec/serializers/vulnerability_entity_spec.rb
+17
-0
No files found.
ee/app/serializers/vulnerability_entity.rb
0 → 100644
View file @
839439b8
# frozen_string_literal: true
class
VulnerabilityEntity
<
Grape
::
Entity
expose
:id
expose
:title
expose
:description
expose
:state
expose
:severity
expose
:confidence
expose
:project
,
using:
::
ProjectEntity
expose
:author_id
expose
:updated_by_id
expose
:last_edited_by_id
expose
:closed_by_id
expose
:start_date
expose
:due_date
expose
:created_at
expose
:updated_at
expose
:last_edited_at
expose
:closed_at
end
ee/spec/fixtures/api/schemas/vulnerability.json
0 → 100644
View file @
839439b8
{
"type"
:
"object"
,
"required"
:
[
"title"
,
"state"
,
"confidence"
,
"severity"
,
"project"
,
"author_id"
],
"properties"
:
{
"title"
:
{
"type"
:
"string"
},
"description"
:
{
"type"
:
[
"string"
,
"null"
]
},
"state"
:
{
"type"
:
"string"
,
"enum"
:
[
"opened"
,
"closed"
]
},
"severity"
:
{
"type"
:
"string"
,
"enum"
:
[
"undefined"
,
"info"
,
"unknown"
,
"low"
,
"medium"
,
"high"
,
"critical"
]
},
"confidence"
:
{
"type"
:
"string"
,
"enum"
:
[
"undefined"
,
"ignore"
,
"unknown"
,
"experimental"
,
"low"
,
"medium"
,
"high"
,
"confirmed"
]
},
"project"
:
{
"required"
:
[
"id"
,
"name"
,
"full_path"
,
"full_name"
],
"id"
:
{
"type"
:
"integer"
},
"name"
:
{
"type"
:
"string"
},
"full_path"
:
{
"type"
:
"string"
},
"full_name"
:
{
"type"
:
"string"
}
},
"author_id"
:
{
"type"
:
"integer"
},
"updated_by_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"last_edited_by_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"closed_by_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"start_date"
:
{
"type"
:
[
"date"
,
"null"
]
},
"due_date"
:
{
"type"
:
[
"date"
,
"null"
]
},
"created_at"
:
{
"type"
:
"date"
},
"updated_at"
:
{
"type"
:
"date"
},
"last_edited_at"
:
{
"type"
:
"date"
},
"closed_at"
:
{
"type"
:
"date"
}
}
}
ee/spec/serializers/vulnerability_entity_spec.rb
0 → 100644
View file @
839439b8
# frozen_string_literal: true
require
'spec_helper'
describe
VulnerabilityEntity
do
let
(
:vulnerability
)
do
create
(
:vulnerability
)
end
let
(
:entity
)
do
described_class
.
represent
(
vulnerability
)
end
subject
{
entity
.
to_json
}
it
{
is_expected
.
to
match_schema
(
'vulnerability'
,
dir:
'ee'
)
}
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