diff options
author | Robert Speicher <rspeicher@gmail.com> | 2018-11-20 13:43:24 +0000 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2018-11-20 13:43:24 +0000 |
commit | 9fe85710f6bfae2363c01c827be434506ddca00a (patch) | |
tree | d30b066658df669efab8bceb14f9986bdfc02f58 /spec/controllers | |
parent | 2ea250d4bff03b656403e85db14cc5a4be593c67 (diff) | |
parent | f1bc7b6eb5cb9beab55e4edac87cc5e0b7ceb069 (diff) | |
download | gitlab-ce-9fe85710f6bfae2363c01c827be434506ddca00a.tar.gz |
Merge branch '49565-ssh-push-mirroring' into 'master'
SSH public-key authentication for push mirroring
Closes #49565
See merge request gitlab-org/gitlab-ce!22982
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/mirrors_controller_spec.rb | 25 |
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 |