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
6d6951a4
Commit
6d6951a4
authored
Apr 03, 2020
by
Tetiana Chupryna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add license_scanning method
parent
c2db4e3e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
ee/app/controllers/ee/projects/merge_requests_controller.rb
ee/app/controllers/ee/projects/merge_requests_controller.rb
+4
-0
ee/spec/controllers/projects/merge_requests_controller_spec.rb
...ec/controllers/projects/merge_requests_controller_spec.rb
+28
-0
No files found.
ee/app/controllers/ee/projects/merge_requests_controller.rb
View file @
6d6951a4
...
...
@@ -50,6 +50,10 @@ module EE
reports_response
(
merge_request
.
compare_license_management_reports
(
current_user
))
end
def
license_scanning_reports
reports_response
(
merge_request
.
compare_license_management_reports
(
current_user
))
end
def
container_scanning_reports
reports_response
(
merge_request
.
compare_container_scanning_reports
(
current_user
))
end
...
...
ee/spec/controllers/projects/merge_requests_controller_spec.rb
View file @
6d6951a4
...
...
@@ -700,6 +700,8 @@ describe Projects::MergeRequestsController do
describe
'GET #license_management_reports'
do
let
(
:merge_request
)
{
create
(
:ee_merge_request
,
:with_license_scanning_reports
,
source_project:
project
,
author:
create
(
:user
))
}
let
(
:comparison_status
)
{
{
status: :parsed
,
data:
{
new_licenses:
[],
existing_licenses:
[],
removed_licenses:
[]
}
}
}
let
(
:params
)
do
{
namespace_id:
project
.
namespace
.
to_param
,
...
...
@@ -710,6 +712,32 @@ describe Projects::MergeRequestsController do
subject
{
get
:license_management_reports
,
params:
params
,
format: :json
}
before
do
allow_any_instance_of
(
::
MergeRequest
).
to
receive
(
:compare_reports
)
.
with
(
::
Ci
::
CompareLicenseScanningReportsService
,
project
.
users
.
first
).
and_return
(
comparison_status
)
end
it
'returns 200 HTTP status'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
eq
({
"new_licenses"
=>
[],
"existing_licenses"
=>
[],
"removed_licenses"
=>
[]
})
end
end
describe
'GET #license_scanning_reports'
do
let
(
:merge_request
)
{
create
(
:ee_merge_request
,
:with_license_scanning_reports
,
source_project:
project
,
author:
create
(
:user
))
}
let
(
:params
)
do
{
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
merge_request
.
iid
}
end
subject
{
get
:license_scanning_reports
,
params:
params
,
format: :json
}
before
do
allow_any_instance_of
(
::
MergeRequest
).
to
receive
(
:compare_reports
)
.
with
(
::
Ci
::
CompareLicenseScanningReportsService
,
project
.
users
.
first
).
and_return
(
comparison_status
)
...
...
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