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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
4865a7ab
Commit
4865a7ab
authored
Apr 05, 2017
by
Mark Fletcher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable creation of deploy keys with write access via the API
* Documentation was incorrectly advertising the missing param
parent
ced322c5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
0 deletions
+18
-0
changelogs/unreleased/30021-api-deploy_keys-can_push-is-not-honoured.yml
...leased/30021-api-deploy_keys-can_push-is-not-honoured.yml
+4
-0
lib/api/deploy_keys.rb
lib/api/deploy_keys.rb
+1
-0
spec/factories/keys.rb
spec/factories/keys.rb
+4
-0
spec/requests/api/deploy_keys_spec.rb
spec/requests/api/deploy_keys_spec.rb
+9
-0
No files found.
changelogs/unreleased/30021-api-deploy_keys-can_push-is-not-honoured.yml
0 → 100644
View file @
4865a7ab
---
title
:
Enable creation of deploy keys with write access via the API
merge_request
:
author
:
lib/api/deploy_keys.rb
View file @
4865a7ab
...
@@ -47,6 +47,7 @@ module API
...
@@ -47,6 +47,7 @@ module API
params
do
params
do
requires
:key
,
type:
String
,
desc:
'The new deploy key'
requires
:key
,
type:
String
,
desc:
'The new deploy key'
requires
:title
,
type:
String
,
desc:
'The name of the deploy key'
requires
:title
,
type:
String
,
desc:
'The name of the deploy key'
optional
:can_push
,
type:
Boolean
,
desc:
"Can deploy key push to the project's repository"
end
end
post
":id/deploy_keys"
do
post
":id/deploy_keys"
do
params
[
:key
].
strip!
params
[
:key
].
strip!
...
...
spec/factories/keys.rb
View file @
4865a7ab
...
@@ -23,5 +23,9 @@ FactoryGirl.define do
...
@@ -23,5 +23,9 @@ FactoryGirl.define do
factory
:another_deploy_key
,
class:
'DeployKey'
do
factory
:another_deploy_key
,
class:
'DeployKey'
do
end
end
end
end
factory
:write_access_key
,
class:
'DeployKey'
do
can_push
true
end
end
end
end
end
spec/requests/api/deploy_keys_spec.rb
View file @
4865a7ab
...
@@ -108,6 +108,15 @@ describe API::DeployKeys, api: true do
...
@@ -108,6 +108,15 @@ describe API::DeployKeys, api: true do
expect
(
response
).
to
have_http_status
(
201
)
expect
(
response
).
to
have_http_status
(
201
)
end
end
it
'accepts can_push parameter'
do
key_attrs
=
attributes_for
:write_access_key
post
api
(
"/projects/
#{
project
.
id
}
/deploy_keys"
,
admin
),
key_attrs
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
'can_push'
]).
to
eq
(
true
)
end
end
end
describe
'DELETE /projects/:id/deploy_keys/:key_id'
do
describe
'DELETE /projects/:id/deploy_keys/:key_id'
do
...
...
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