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
705e1b57
Commit
705e1b57
authored
Apr 02, 2020
by
Tetiana Chupryna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove redundant key
parent
8a384e0b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
95 deletions
+0
-95
ee/app/serializers/ee/merge_request_widget_entity.rb
ee/app/serializers/ee/merge_request_widget_entity.rb
+0
-19
ee/spec/serializers/merge_request_widget_entity_spec.rb
ee/spec/serializers/merge_request_widget_entity_spec.rb
+0
-76
No files found.
ee/app/serializers/ee/merge_request_widget_entity.rb
View file @
705e1b57
...
@@ -40,25 +40,6 @@ module EE
...
@@ -40,25 +40,6 @@ module EE
merge_request
.
enabled_reports
merge_request
.
enabled_reports
end
end
# TODO: remove after https://gitlab.com/gitlab-org/gitlab/issues/205304 is done
expose
:license_management
,
if:
->
(
mr
,
_
)
{
head_pipeline_downloadable_path_for_report_type
(
:license_management
)
}
do
expose
:managed_licenses_path
do
|
merge_request
|
expose_path
(
api_v4_projects_managed_licenses_path
(
id:
merge_request
.
target_project
.
id
))
end
expose
:can_manage_licenses
do
|
merge_request
|
can?
(
current_user
,
:admin_software_license_policy
,
merge_request
)
end
expose
:license_management_settings_path
,
if:
->
(
mr
,
_
)
{
can?
(
current_user
,
:admin_software_license_policy
,
mr
.
target_project
)
}
do
|
merge_request
|
license_management_settings_path
(
merge_request
.
target_project
)
end
expose
:license_management_full_report_path
,
if:
->
(
mr
,
_
)
{
mr
.
head_pipeline
}
do
|
merge_request
|
licenses_project_pipeline_path
(
merge_request
.
target_project
,
merge_request
.
head_pipeline
)
end
end
expose
:license_scanning
,
if:
->
(
mr
,
_
)
{
head_pipeline_downloadable_path_for_report_type
(
:license_scanning
)
}
do
expose
:license_scanning
,
if:
->
(
mr
,
_
)
{
head_pipeline_downloadable_path_for_report_type
(
:license_scanning
)
}
do
expose
:managed_licenses_path
do
|
merge_request
|
expose
:managed_licenses_path
do
|
merge_request
|
expose_path
(
api_v4_projects_managed_licenses_path
(
id:
merge_request
.
target_project
.
id
))
expose_path
(
api_v4_projects_managed_licenses_path
(
id:
merge_request
.
target_project
.
id
))
...
...
ee/spec/serializers/merge_request_widget_entity_spec.rb
View file @
705e1b57
...
@@ -99,82 +99,6 @@ describe MergeRequestWidgetEntity do
...
@@ -99,82 +99,6 @@ describe MergeRequestWidgetEntity do
end
end
end
end
describe
'#license_management'
,
:request_store
do
before
do
allow
(
merge_request
).
to
receive_messages
(
head_pipeline:
pipeline
,
target_project:
project
)
stub_licensed_features
(
license_management:
true
)
end
it
'is not included, if missing artifacts'
do
expect
(
subject
.
as_json
).
not_to
include
(
:license_management
)
end
context
'when report artifact is defined'
do
before
do
create
(
:ee_ci_build
,
:license_management
,
pipeline:
pipeline
)
end
it
'is included'
do
expect
(
subject
.
as_json
).
to
include
(
:license_management
)
expect
(
subject
.
as_json
[
:license_management
]).
to
include
(
:managed_licenses_path
)
expect
(
subject
.
as_json
[
:license_management
]).
to
include
(
:can_manage_licenses
)
expect
(
subject
.
as_json
[
:license_management
]).
to
include
(
:license_management_full_report_path
)
end
context
'when feature is not licensed'
do
before
do
stub_licensed_features
(
license_scanning:
false
)
end
it
'is not included'
do
expect
(
subject
.
as_json
).
not_to
include
(
:license_management
)
end
end
it
'#license_management_settings_path should not be included for developers'
do
expect
(
subject
.
as_json
[
:license_management
]).
not_to
include
(
:license_management_settings_path
)
end
context
'when user is maintainer'
do
before
do
project
.
add_maintainer
(
user
)
end
it
'#license_management_settings_path should be included for maintainers'
do
expect
(
subject
.
as_json
[
:license_management
]).
to
include
(
:license_management_settings_path
)
end
end
end
describe
'#managed_licenses_path'
do
let
(
:managed_licenses_path
)
{
expose_path
(
api_v4_projects_managed_licenses_path
(
id:
project
.
id
))
}
before
do
create
(
:ee_ci_build
,
:license_management
,
pipeline:
pipeline
)
end
it
'is a path for target project'
do
expect
(
subject
.
as_json
[
:license_management
][
:managed_licenses_path
]).
to
eq
(
managed_licenses_path
)
end
context
'with fork'
do
let
(
:source_project
)
{
fork_project
(
project
,
user
,
repository:
true
)
}
let
(
:fork_merge_request
)
{
create
(
:merge_request
,
source_project:
source_project
,
target_project:
project
)
}
let
(
:subject_json
)
{
described_class
.
new
(
fork_merge_request
,
current_user:
user
,
request:
request
).
as_json
}
before
do
allow
(
fork_merge_request
).
to
receive_messages
(
head_pipeline:
pipeline
)
stub_licensed_features
(
license_management:
true
)
end
it
'is a path for target project'
do
expect
(
subject_json
[
:license_management
][
:managed_licenses_path
]).
to
eq
(
managed_licenses_path
)
end
end
end
end
describe
'#license_scanning'
,
:request_store
do
describe
'#license_scanning'
,
:request_store
do
before
do
before
do
allow
(
merge_request
).
to
receive_messages
(
head_pipeline:
pipeline
,
target_project:
project
)
allow
(
merge_request
).
to
receive_messages
(
head_pipeline:
pipeline
,
target_project:
project
)
...
...
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