Commit 4865a7ab authored by Mark Fletcher's avatar Mark Fletcher

Enable creation of deploy keys with write access via the API

* Documentation was incorrectly advertising the missing param
parent ced322c5
---
title: Enable creation of deploy keys with write access via the API
merge_request:
author:
...@@ -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!
......
...@@ -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
...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment