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
20cf2dea
Commit
20cf2dea
authored
Apr 07, 2020
by
Tetiana Chupryna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update relevant tests
parent
b8438780
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
43 deletions
+16
-43
ee/spec/controllers/projects/merge_requests_controller_spec.rb
...ec/controllers/projects/merge_requests_controller_spec.rb
+0
-27
ee/spec/models/merge_request_spec.rb
ee/spec/models/merge_request_spec.rb
+16
-16
No files found.
ee/spec/controllers/projects/merge_requests_controller_spec.rb
View file @
20cf2dea
...
...
@@ -698,33 +698,6 @@ describe Projects::MergeRequestsController do
it_behaves_like
'authorize read pipeline'
end
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
,
project_id:
project
,
id:
merge_request
.
iid
}
end
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
))
}
...
...
ee/spec/models/merge_request_spec.rb
View file @
20cf2dea
...
...
@@ -115,9 +115,9 @@ describe MergeRequest do
:container_scanning
|
:with_container_scanning_reports
|
:container_scanning
:dast
|
:with_dast_reports
|
:dast
:dependency_scanning
|
:with_dependency_scanning_reports
|
:dependency_scanning
:license_management
|
:with_license_management_reports
|
:license_
management
:license_management
|
:with_license_scanning_reports
|
:license_
management
:license_scanning
|
:with_license_scanning_reports
|
:license_
management
:license_management
|
:with_license_management_reports
|
:license_
scanning
:license_management
|
:with_license_scanning_reports
|
:license_
scanning
:license_scanning
|
:with_license_scanning_reports
|
:license_
scanning
end
with_them
do
...
...
@@ -162,22 +162,22 @@ describe MergeRequest do
end
end
describe
'#has_license_
management
_reports?'
do
subject
{
merge_request
.
has_license_
management
_reports?
}
describe
'#has_license_
scanning
_reports?'
do
subject
{
merge_request
.
has_license_
scanning
_reports?
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
before
do
stub_licensed_features
(
license_
management
:
true
)
stub_licensed_features
(
license_
scanning
:
true
)
end
context
'when head pipeline has license
management
reports'
do
let
(
:merge_request
)
{
create
(
:ee_merge_request
,
:with_license_
management
_reports
,
source_project:
project
)
}
context
'when head pipeline has license
scanning
reports'
do
let
(
:merge_request
)
{
create
(
:ee_merge_request
,
:with_license_
scanning
_reports
,
source_project:
project
)
}
it
{
is_expected
.
to
be_truthy
}
end
context
'when head pipeline does not have license
management
reports'
do
context
'when head pipeline does not have license
scanning
reports'
do
let
(
:merge_request
)
{
create
(
:ee_merge_request
,
source_project:
project
)
}
it
{
is_expected
.
to
be_falsey
}
...
...
@@ -439,8 +439,8 @@ describe MergeRequest do
end
end
describe
'#compare_license_
management
_reports'
do
subject
{
merge_request
.
compare_license_
management
_reports
(
current_user
)
}
describe
'#compare_license_
scanning
_reports'
do
subject
{
merge_request
.
compare_license_
scanning
_reports
(
current_user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:current_user
)
{
project
.
users
.
first
}
...
...
@@ -448,7 +448,7 @@ describe MergeRequest do
let!
(
:base_pipeline
)
do
create
(
:ee_ci_pipeline
,
:with_license_
management
_report
,
:with_license_
scanning
_report
,
project:
project
,
ref:
merge_request
.
target_branch
,
sha:
merge_request
.
diff_base_sha
)
...
...
@@ -458,10 +458,10 @@ describe MergeRequest do
merge_request
.
update!
(
head_pipeline_id:
head_pipeline
.
id
)
end
context
'when head pipeline has license
management
reports'
do
context
'when head pipeline has license
scanning
reports'
do
let!
(
:head_pipeline
)
do
create
(
:ee_ci_pipeline
,
:with_license_
management
_report
,
:with_license_
scanning
_report
,
project:
project
,
ref:
merge_request
.
source_branch
,
sha:
merge_request
.
diff_head_sha
)
...
...
@@ -510,7 +510,7 @@ describe MergeRequest do
end
end
context
'when head pipeline does not have license
management
reports'
do
context
'when head pipeline does not have license
scanning
reports'
do
let!
(
:head_pipeline
)
do
create
(
:ci_pipeline
,
project:
project
,
...
...
@@ -520,7 +520,7 @@ describe MergeRequest do
it
'returns status and error message'
do
expect
(
subject
[
:status
]).
to
eq
(
:error
)
expect
(
subject
[
:status_reason
]).
to
eq
(
'This merge request does not have license
management
reports'
)
expect
(
subject
[
:status_reason
]).
to
eq
(
'This merge request does not have license
scanning
reports'
)
end
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