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
0146f8ef
Commit
0146f8ef
authored
Dec 05, 2019
by
mo khan
Committed by
Ash McKenzie
Dec 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure the old API returns the old values
parent
8c3a1891
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
9 deletions
+11
-9
ee/app/models/software_license_policy.rb
ee/app/models/software_license_policy.rb
+1
-1
ee/lib/ee/api/entities.rb
ee/lib/ee/api/entities.rb
+3
-1
ee/spec/requests/api/managed_licenses_spec.rb
ee/spec/requests/api/managed_licenses_spec.rb
+7
-7
No files found.
ee/app/models/software_license_policy.rb
View file @
0146f8ef
...
@@ -14,7 +14,7 @@ class SoftwareLicensePolicy < ApplicationRecord
...
@@ -14,7 +14,7 @@ class SoftwareLicensePolicy < ApplicationRecord
attr_readonly
:software_license
attr_readonly
:software_license
enum
classification:
{
enum
classification:
{
denied:
0
,
denied:
0
,
approved:
1
approved:
1
}
}
...
...
ee/lib/ee/api/entities.rb
View file @
0146f8ef
...
@@ -861,7 +861,9 @@ module EE
...
@@ -861,7 +861,9 @@ module EE
class
ManagedLicense
<
Grape
::
Entity
class
ManagedLicense
<
Grape
::
Entity
expose
:id
,
:name
expose
:id
,
:name
expose
:classification
,
as: :approval_status
expose
:classification
,
as: :approval_status
do
|
policy
|
policy
.
denied?
?
'blacklisted'
:
policy
.
classification
end
end
end
class
ProjectAlias
<
Grape
::
Entity
class
ProjectAlias
<
Grape
::
Entity
...
...
ee/spec/requests/api/managed_licenses_spec.rb
View file @
0146f8ef
...
@@ -38,7 +38,7 @@ describe API::ManagedLicenses do
...
@@ -38,7 +38,7 @@ describe API::ManagedLicenses do
expect
(
json_response
).
to
be_a
(
Array
)
expect
(
json_response
).
to
be_a
(
Array
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
software_license_policy
.
id
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
software_license_policy
.
id
)
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
software_license_policy
.
name
)
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
software_license_policy
.
name
)
expect
(
json_response
.
first
[
'approval_status'
]).
to
eq
(
software_license_policy
.
classification
)
expect
(
json_response
.
first
[
'approval_status'
]).
to
eq
(
'approved'
)
end
end
end
end
...
@@ -51,7 +51,7 @@ describe API::ManagedLicenses do
...
@@ -51,7 +51,7 @@ describe API::ManagedLicenses do
expect
(
json_response
).
to
be_a
(
Array
)
expect
(
json_response
).
to
be_a
(
Array
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
software_license_policy
.
id
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
software_license_policy
.
id
)
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
software_license_policy
.
name
)
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
software_license_policy
.
name
)
expect
(
json_response
.
first
[
'approval_status'
]).
to
eq
(
software_license_policy
.
classification
)
expect
(
json_response
.
first
[
'approval_status'
]).
to
eq
(
'approved'
)
end
end
end
end
...
@@ -92,7 +92,7 @@ describe API::ManagedLicenses do
...
@@ -92,7 +92,7 @@ describe API::ManagedLicenses do
expect
(
response
).
to
match_response_schema
(
'software_license_policy'
,
dir:
'ee'
)
expect
(
response
).
to
match_response_schema
(
'software_license_policy'
,
dir:
'ee'
)
expect
(
json_response
[
'id'
]).
to
eq
(
software_license_policy
.
id
)
expect
(
json_response
[
'id'
]).
to
eq
(
software_license_policy
.
id
)
expect
(
json_response
[
'name'
]).
to
eq
(
software_license_policy
.
name
)
expect
(
json_response
[
'name'
]).
to
eq
(
software_license_policy
.
name
)
expect
(
json_response
[
'approval_status'
]).
to
eq
(
software_license_policy
.
classification
)
expect
(
json_response
[
'approval_status'
]).
to
eq
(
'approved'
)
end
end
it
'returns project managed license details using the license name as key'
do
it
'returns project managed license details using the license name as key'
do
...
@@ -103,7 +103,7 @@ describe API::ManagedLicenses do
...
@@ -103,7 +103,7 @@ describe API::ManagedLicenses do
expect
(
response
).
to
match_response_schema
(
'software_license_policy'
,
dir:
'ee'
)
expect
(
response
).
to
match_response_schema
(
'software_license_policy'
,
dir:
'ee'
)
expect
(
json_response
[
'id'
]).
to
eq
(
software_license_policy
.
id
)
expect
(
json_response
[
'id'
]).
to
eq
(
software_license_policy
.
id
)
expect
(
json_response
[
'name'
]).
to
eq
(
software_license_policy
.
name
)
expect
(
json_response
[
'name'
]).
to
eq
(
software_license_policy
.
name
)
expect
(
json_response
[
'approval_status'
]).
to
eq
(
software_license_policy
.
classification
)
expect
(
json_response
[
'approval_status'
]).
to
eq
(
'approved'
)
end
end
it
'responds with 404 Not Found if requesting non-existing managed license'
do
it
'responds with 404 Not Found if requesting non-existing managed license'
do
...
@@ -121,7 +121,7 @@ describe API::ManagedLicenses do
...
@@ -121,7 +121,7 @@ describe API::ManagedLicenses do
expect
(
response
).
to
match_response_schema
(
'software_license_policy'
,
dir:
'ee'
)
expect
(
response
).
to
match_response_schema
(
'software_license_policy'
,
dir:
'ee'
)
expect
(
json_response
[
'id'
]).
to
eq
(
software_license_policy
.
id
)
expect
(
json_response
[
'id'
]).
to
eq
(
software_license_policy
.
id
)
expect
(
json_response
[
'name'
]).
to
eq
(
software_license_policy
.
name
)
expect
(
json_response
[
'name'
]).
to
eq
(
software_license_policy
.
name
)
expect
(
json_response
[
'approval_status'
]).
to
eq
(
software_license_policy
.
classification
)
expect
(
json_response
[
'approval_status'
]).
to
eq
(
'approved'
)
end
end
end
end
...
@@ -220,10 +220,10 @@ describe API::ManagedLicenses do
...
@@ -220,10 +220,10 @@ describe API::ManagedLicenses do
# Check that response is equal to the updated object
# Check that response is equal to the updated object
expect
(
json_response
[
'id'
]).
to
eq
(
initial_id
)
expect
(
json_response
[
'id'
]).
to
eq
(
initial_id
)
expect
(
json_response
[
'name'
]).
to
eq
(
updated_software_license_policy
.
name
)
expect
(
json_response
[
'name'
]).
to
eq
(
updated_software_license_policy
.
name
)
expect
(
json_response
[
'approval_status'
]).
to
eq
(
updated_software_license_policy
.
classification
)
expect
(
json_response
[
'approval_status'
]).
to
eq
(
'blacklisted'
)
# Check that the approval status was updated
# Check that the approval status was updated
expect
(
updated_software_license_policy
.
classification
).
to
eq
(
'blacklisted'
)
expect
(
updated_software_license_policy
).
to
be_denied
# Check that response is equal to the old object except for the approval status
# Check that response is equal to the old object except for the approval status
expect
(
initial_id
).
to
eq
(
updated_software_license_policy
.
id
)
expect
(
initial_id
).
to
eq
(
updated_software_license_policy
.
id
)
...
...
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