diff options
author | Rémy Coutable <remy@rymai.me> | 2017-06-21 13:08:16 +0300 |
---|---|---|
committer | kushalpandya <kushal@gitlab.com> | 2017-06-21 15:42:03 +0300 |
commit | a3acf98ef2e922712b2d52ca524b3557452d8f34 (patch) | |
tree | b69e7ea9ec637457945b0bc3640ab2adb838cc9a /spec | |
parent | 71efad75c37fccae40d9a399a0ae9545f3f63a41 (diff) |
Merge branch '33878-fix-edit-deploy-key' into 'master'
Fix edit button for deploy keys available from other projects
Closes #33878
See merge request !12301
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/projects/settings/repository_settings_spec.rb | 17 | ||||
-rw-r--r-- | spec/requests/api/deploy_keys_spec.rb | 10 |
2 files changed, 27 insertions, 0 deletions
diff --git a/spec/features/projects/settings/repository_settings_spec.rb b/spec/features/projects/settings/repository_settings_spec.rb index 4cc38c5286e..a93f57eeec8 100644 --- a/spec/features/projects/settings/repository_settings_spec.rb +++ b/spec/features/projects/settings/repository_settings_spec.rb @@ -65,6 +65,23 @@ feature 'Repository settings', feature: true do expect(page).to have_content('Write access allowed') end + scenario 'edit a deploy key from projects user has access to' do + project2 = create(:project_empty_repo) + project2.team << [user, role] + project2.deploy_keys << private_deploy_key + + visit namespace_project_settings_repository_path(project.namespace, project) + + find('li', text: private_deploy_key.title).click_link('Edit') + + fill_in 'deploy_key_title', with: 'updated_deploy_key' + check 'deploy_key_can_push' + click_button 'Save changes' + + expect(page).to have_content('updated_deploy_key') + expect(page).to have_content('Write access allowed') + end + scenario 'remove an existing deploy key' do project.deploy_keys << private_deploy_key visit namespace_project_settings_repository_path(project.namespace, project) diff --git a/spec/requests/api/deploy_keys_spec.rb b/spec/requests/api/deploy_keys_spec.rb index 4d9cd5f3a27..42332d27c06 100644 --- a/spec/requests/api/deploy_keys_spec.rb +++ b/spec/requests/api/deploy_keys_spec.rb @@ -158,6 +158,16 @@ describe API::DeployKeys do expect(json_response['title']).to eq('new title') expect(json_response['can_push']).to eq(true) end + + it 'updates a private ssh key from projects user has access with correct attributes' do + create(:deploy_keys_project, project: project2, deploy_key: private_deploy_key) + + put api("/projects/#{project.id}/deploy_keys/#{private_deploy_key.id}", admin), { title: 'new title', can_push: true } + + expect(json_response['id']).to eq(private_deploy_key.id) + expect(json_response['title']).to eq('new title') + expect(json_response['can_push']).to eq(true) + end end describe 'DELETE /projects/:id/deploy_keys/:key_id' do |