Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2018-11-12 13:52:48 +0300
committerNick Thomas <nick@gitlab.com>2018-11-19 14:46:39 +0300
commitf1bc7b6eb5cb9beab55e4edac87cc5e0b7ceb069 (patch)
tree2e5aedd22e2fd05909c1e97c5bc52602feadc825 /spec/controllers/projects
parentb1b4c94484b0613a6a457e32218d4f62b9eb2029 (diff)
SSH public-key authentication for push mirroring
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r--spec/controllers/projects/mirrors_controller_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/controllers/projects/mirrors_controller_spec.rb b/spec/controllers/projects/mirrors_controller_spec.rb
index 00c1e617e3a..976f480930c 100644
--- a/spec/controllers/projects/mirrors_controller_spec.rb
+++ b/spec/controllers/projects/mirrors_controller_spec.rb
@@ -15,6 +15,31 @@ describe Projects::MirrorsController do
end.to change { RemoteMirror.count }.to(1)
end
end
+
+ context 'setting up SSH public-key authentication' do
+ let(:ssh_mirror_attributes) do
+ {
+ 'auth_method' => 'ssh_public_key',
+ 'url' => 'ssh://git@example.com',
+ 'ssh_known_hosts' => 'test'
+ }
+ end
+
+ it 'processes a successful update' do
+ sign_in(project.owner)
+ do_put(project, remote_mirrors_attributes: { '0' => ssh_mirror_attributes })
+
+ expect(response).to redirect_to(project_settings_repository_path(project, anchor: 'js-push-remote-settings'))
+
+ expect(RemoteMirror.count).to eq(1)
+ expect(RemoteMirror.first).to have_attributes(
+ auth_method: 'ssh_public_key',
+ url: 'ssh://git@example.com',
+ ssh_public_key: match(/\Assh-rsa /),
+ ssh_known_hosts: 'test'
+ )
+ end
+ end
end
describe '#update' do