summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-12-27 15:00:49 +0000
committerDouwe Maan <douwe@gitlab.com>2016-12-27 15:00:49 +0000
commit20afb4c69ee91a91094eed2bffd566c5bca1ce0d (patch)
tree632bbb3e3e8978a8d7bb2e26dd91edf9b83ecd4d /features
parentcdb29c2fb00a873e8f8f646b06c7b000cc13e610 (diff)
parentc1d11bf57c3091aa4695e302e21c39b9ec723f54 (diff)
downloadgitlab-ce-20afb4c69ee91a91094eed2bffd566c5bca1ce0d.tar.gz
Merge branch 'feature/1376-allow-write-access-deploy-keys' into 'master'
Allow to add deploy keys with write-access Closes #1376 See merge request !7383
Diffstat (limited to 'features')
-rw-r--r--features/admin/deploy_keys.feature23
-rw-r--r--features/steps/admin/deploy_keys.rb59
2 files changed, 82 insertions, 0 deletions
diff --git a/features/admin/deploy_keys.feature b/features/admin/deploy_keys.feature
new file mode 100644
index 00000000000..95ac77cddd2
--- /dev/null
+++ b/features/admin/deploy_keys.feature
@@ -0,0 +1,23 @@
+@admin
+Feature: Admin Deploy Keys
+ Background:
+ Given I sign in as an admin
+ And there are public deploy keys in system
+
+ Scenario: Deploy Keys list
+ When I visit admin deploy keys page
+ Then I should see all public deploy keys
+
+ Scenario: Deploy Keys new
+ When I visit admin deploy keys page
+ And I click 'New Deploy Key'
+ And I submit new deploy key
+ Then I should be on admin deploy keys page
+ And I should see newly created deploy key without write access
+
+ Scenario: Deploy Keys new with write access
+ When I visit admin deploy keys page
+ And I click 'New Deploy Key'
+ And I submit new deploy key with write access
+ Then I should be on admin deploy keys page
+ And I should see newly created deploy key with write access
diff --git a/features/steps/admin/deploy_keys.rb b/features/steps/admin/deploy_keys.rb
new file mode 100644
index 00000000000..79312a5d1c5
--- /dev/null
+++ b/features/steps/admin/deploy_keys.rb
@@ -0,0 +1,59 @@
+class Spinach::Features::AdminDeployKeys < Spinach::FeatureSteps
+ include SharedAuthentication
+ include SharedPaths
+ include SharedAdmin
+
+ step 'there are public deploy keys in system' do
+ create(:deploy_key, public: true)
+ create(:another_deploy_key, public: true)
+ end
+
+ step 'I should see all public deploy keys' do
+ DeployKey.are_public.each do |p|
+ expect(page).to have_content p.title
+ end
+ end
+
+ step 'I visit admin deploy key page' do
+ visit admin_deploy_key_path(deploy_key)
+ end
+
+ step 'I visit admin deploy keys page' do
+ visit admin_deploy_keys_path
+ end
+
+ step 'I click \'New Deploy Key\'' do
+ click_link 'New Deploy Key'
+ end
+
+ step 'I submit new deploy key' do
+ fill_in "deploy_key_title", with: "laptop"
+ fill_in "deploy_key_key", with: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop"
+ click_button "Create"
+ end
+
+ step 'I submit new deploy key with write access' do
+ fill_in "deploy_key_title", with: "server"
+ fill_in "deploy_key_key", with: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop"
+ check "deploy_key_can_push"
+ click_button "Create"
+ end
+
+ step 'I should be on admin deploy keys page' do
+ expect(current_path).to eq admin_deploy_keys_path
+ end
+
+ step 'I should see newly created deploy key without write access' do
+ expect(page).to have_content(deploy_key.title)
+ expect(page).to have_content('No')
+ end
+
+ step 'I should see newly created deploy key with write access' do
+ expect(page).to have_content(deploy_key.title)
+ expect(page).to have_content('Yes')
+ end
+
+ def deploy_key
+ @deploy_key ||= DeployKey.are_public.first
+ end
+end