debian-mirror-gitlab/spec/features/projects/deploy_keys_spec.rb

51 lines
1.4 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe 'Project deploy keys', :js, feature_category: :projects do
2022-08-13 15:12:31 +05:30
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-08-17 22:00:37 +05:30
before do
2018-11-18 11:00:15 +05:30
project.add_maintainer(user)
2017-09-10 17:25:29 +05:30
sign_in(user)
2017-08-17 22:00:37 +05:30
end
2022-08-13 15:12:31 +05:30
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-08-17 22:00:37 +05:30
describe 'removing key' do
before do
2022-08-13 15:12:31 +05:30
visit project_settings_repository_path(project)
2017-08-17 22:00:37 +05:30
end
it 'removes association between project and deploy key' do
2021-06-08 01:23:25 +05:30
page.within(find('.rspec-deploy-keys-settings')) do
2018-10-15 14:42:47 +05:30
expect(page).to have_selector('.deploy-key', count: 1)
2017-08-17 22:00:37 +05:30
2021-06-08 01:23:25 +05:30
click_button 'Remove'
click_button 'Remove deploy key'
2017-08-17 22:00:37 +05:30
2018-11-08 19:23:39 +05:30
wait_for_requests
2018-10-15 14:42:47 +05:30
expect(page).to have_selector('.deploy-key', count: 0)
2017-08-17 22:00:37 +05:30
end
end
end
end