diff options
author | Rémy Coutable <remy@rymai.me> | 2017-06-01 13:11:11 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-06-01 13:11:11 +0000 |
commit | f07aee72bef4604312e11a43fce3a47865bce100 (patch) | |
tree | a7adcdbe50246caf24dc27a16db397a7b8d34483 | |
parent | 483d88a9cdc8dc8f699b962c206eaa007aa370ef (diff) | |
parent | 00893f31b32bd5118e8d7eea3e0e90fe8fa90cb8 (diff) | |
download | gitlab-ce-f07aee72bef4604312e11a43fce3a47865bce100.tar.gz |
Merge branch 'bugfix/deploy_keys__can_push__usage_in_api' into 'master'
Add missing `can_push` parameter to POST /v3/deploy_keys
See merge request !11607
-rw-r--r-- | changelogs/unreleased/bugfix-v3-deploy_keys-can_push.yml | 4 | ||||
-rw-r--r-- | lib/api/v3/deploy_keys.rb | 1 | ||||
-rw-r--r-- | spec/requests/api/v3/deploy_keys_spec.rb | 9 |
3 files changed, 14 insertions, 0 deletions
diff --git a/changelogs/unreleased/bugfix-v3-deploy_keys-can_push.yml b/changelogs/unreleased/bugfix-v3-deploy_keys-can_push.yml new file mode 100644 index 00000000000..0306663ac8d --- /dev/null +++ b/changelogs/unreleased/bugfix-v3-deploy_keys-can_push.yml @@ -0,0 +1,4 @@ +--- +title: "Fixed handling of the `can_push` attribute in the v3 deploy_keys api" +merge_request: 11607 +author: Richard Clamp diff --git a/lib/api/v3/deploy_keys.rb b/lib/api/v3/deploy_keys.rb index bbb174b6003..b90e2061da3 100644 --- a/lib/api/v3/deploy_keys.rb +++ b/lib/api/v3/deploy_keys.rb @@ -41,6 +41,7 @@ module API params do requires :key, type: String, desc: 'The new 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 post ":id/#{path}" do params[:key].strip! diff --git a/spec/requests/api/v3/deploy_keys_spec.rb b/spec/requests/api/v3/deploy_keys_spec.rb index b61b2b618a6..94f4d93a8dc 100644 --- a/spec/requests/api/v3/deploy_keys_spec.rb +++ b/spec/requests/api/v3/deploy_keys_spec.rb @@ -105,6 +105,15 @@ describe API::V3::DeployKeys do expect(response).to have_http_status(201) end + + it 'accepts can_push parameter' do + key_attrs = attributes_for :write_access_key + + post v3_api("/projects/#{project.id}/#{path}", admin), key_attrs + + expect(response).to have_http_status(201) + expect(json_response['can_push']).to eq(true) + end end describe "DELETE /projects/:id/#{path}/:key_id" do |