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
c3fd1491
Commit
c3fd1491
authored
Nov 06, 2017
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add blob_path to sast data
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
dfa600a6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
5 deletions
+21
-5
app/serializers/merge_request_entity.rb
app/serializers/merge_request_entity.rb
+10
-4
spec/ee/spec/models/ee/merge_request_spec.rb
spec/ee/spec/models/ee/merge_request_spec.rb
+10
-0
spec/ee/spec/serializers/merge_request_entity_spec.rb
spec/ee/spec/serializers/merge_request_entity_spec.rb
+1
-1
No files found.
app/serializers/merge_request_entity.rb
View file @
c3fd1491
...
...
@@ -212,10 +212,16 @@ class MergeRequestEntity < IssuableEntity
end
end
expose
:sast_path
,
if:
->
(
mr
,
_
)
{
expose_sast_data?
(
mr
,
current_user
)
}
do
|
merge_request
|
raw_project_build_artifacts_url
(
merge_request
.
source_project
,
merge_request
.
sast_artifact
,
path:
'gl-sast-report.json'
)
expose
:sast
,
if:
->
(
mr
,
_
)
{
expose_sast_data?
(
mr
,
current_user
)
}
do
expose
:path
do
|
merge_request
|
raw_project_build_artifacts_url
(
merge_request
.
source_project
,
merge_request
.
sast_artifact
,
path:
'gl-sast-report.json'
)
end
expose
:blob_path
,
if:
->
(
mr
,
_
)
{
mr
.
head_pipeline_sha
}
do
|
merge_request
|
project_blob_path
(
merge_request
.
project
,
merge_request
.
head_pipeline_sha
)
end
end
private
...
...
spec/ee/spec/models/ee/merge_request_spec.rb
View file @
c3fd1491
...
...
@@ -170,4 +170,14 @@ describe MergeRequest do
describe
'#sast_artifact'
do
it
{
is_expected
.
to
delegate_method
(
:sast_artifact
).
to
(
:head_pipeline
)
}
end
describe
'#has_sast_data?'
do
let
(
:artifact
)
{
double
(
success?:
true
)
}
before
do
allow
(
merge_request
).
to
receive
(
:sast_artifact
).
and_return
(
artifact
)
end
it
{
expect
(
merge_request
.
has_sast_data?
).
to
be_truthy
}
end
end
spec/ee/spec/serializers/merge_request_entity_spec.rb
View file @
c3fd1491
...
...
@@ -15,6 +15,6 @@ describe MergeRequestEntity do
allow
(
subject
).
to
receive
(
:expose_sast_data?
).
and_return
(
true
)
allow
(
merge_request
).
to
receive
(
:sast_artifact
).
and_return
(
build
)
expect
(
subject
.
as_json
).
to
include
(
:sast
_path
)
expect
(
subject
.
as_json
).
to
include
(
:sast
)
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