2019-07-25 01:24:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-03-23 10:45:25 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-16 14:09:01 -04:00
|
|
|
RSpec.describe 'Project deploy keys', :js do
|
2022-07-09 08:08:17 -04:00
|
|
|
let_it_be(:user) { create(:user) }
|
|
|
|
let_it_be(:project) { create(:project_empty_repo) }
|
|
|
|
let_it_be(:deploy_keys_project) { create(:deploy_keys_project, project: project) }
|
|
|
|
let_it_be(:deploy_key) { deploy_keys_project.deploy_key }
|
2017-03-23 10:45:25 -04:00
|
|
|
|
|
|
|
before do
|
2018-07-11 10:36:08 -04:00
|
|
|
project.add_maintainer(user)
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
2017-03-23 10:45:25 -04:00
|
|
|
end
|
|
|
|
|
2022-07-09 08:08:17 -04:00
|
|
|
context 'editing key' do
|
|
|
|
it 'shows fingerprints' do
|
|
|
|
visit edit_project_deploy_key_path(project, deploy_key)
|
|
|
|
|
|
|
|
expect(page).to have_content('Fingerprint (SHA256)')
|
|
|
|
expect(find('#deploy_key_fingerprint_sha256').value).to eq(deploy_key.fingerprint_sha256)
|
|
|
|
|
|
|
|
if Gitlab::FIPS.enabled?
|
|
|
|
expect(page).not_to have_content('Fingerprint (MD5)')
|
|
|
|
else
|
|
|
|
expect(page).to have_content('Fingerprint (MD5)')
|
|
|
|
expect(find('#deploy_key_fingerprint').value).to eq(deploy_key.fingerprint)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-03-23 10:45:25 -04:00
|
|
|
describe 'removing key' do
|
|
|
|
before do
|
2022-07-09 08:08:17 -04:00
|
|
|
visit project_settings_repository_path(project)
|
2017-03-23 10:45:25 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'removes association between project and deploy key' do
|
2021-05-03 17:10:09 -04:00
|
|
|
page.within(find('.rspec-deploy-keys-settings')) do
|
2018-05-07 14:21:34 -04:00
|
|
|
expect(page).to have_selector('.deploy-key', count: 1)
|
2017-04-28 15:59:20 -04:00
|
|
|
|
2021-04-22 11:09:56 -04:00
|
|
|
click_button 'Remove'
|
|
|
|
click_button 'Remove deploy key'
|
2017-04-28 15:59:20 -04:00
|
|
|
|
2018-06-14 01:05:05 -04:00
|
|
|
wait_for_requests
|
|
|
|
|
2018-05-07 14:21:34 -04:00
|
|
|
expect(page).to have_selector('.deploy-key', count: 0)
|
2017-03-23 10:45:25 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|