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/models/remote_mirror_spec.rb | |
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/models/remote_mirror_spec.rb')
-rw-r--r-- | spec/models/remote_mirror_spec.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/models/remote_mirror_spec.rb b/spec/models/remote_mirror_spec.rb index 3d316fb3c5b..da61a5f2771 100644 --- a/spec/models/remote_mirror_spec.rb +++ b/spec/models/remote_mirror_spec.rb @@ -222,14 +222,26 @@ describe RemoteMirror do context '#ensure_remote!' do let(:remote_mirror) { create(:project, :repository, :remote_mirror).remote_mirrors.first } + let(:project) { remote_mirror.project } + let(:repository) { project.repository } it 'adds a remote multiple times with no errors' do - expect(remote_mirror.project.repository).to receive(:add_remote).with(remote_mirror.remote_name, remote_mirror.url).twice.and_call_original + expect(repository).to receive(:add_remote).with(remote_mirror.remote_name, remote_mirror.url).twice.and_call_original 2.times do remote_mirror.ensure_remote! end end + + context 'SSH public-key authentication' do + it 'omits the password from the URL' do + remote_mirror.update!(auth_method: 'ssh_public_key', url: 'ssh://git:pass@example.com') + + expect(repository).to receive(:add_remote).with(remote_mirror.remote_name, 'ssh://git@example.com') + + remote_mirror.ensure_remote! + end + end end context '#updated_since?' do |