diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-14 00:08:14 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-14 00:08:14 +0000 |
commit | 427c549b6396885fb60a687326b6cd62878e4ca3 (patch) | |
tree | 145713e2f6fdaf7499b0cb44010503e16b6248b9 /spec/finders | |
parent | 74a89b1221eaf780374bd1d4c5b2ee4a0f488908 (diff) | |
download | gitlab-ce-427c549b6396885fb60a687326b6cd62878e4ca3.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/finders')
-rw-r--r-- | spec/finders/keys_finder_spec.rb | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/spec/finders/keys_finder_spec.rb b/spec/finders/keys_finder_spec.rb index f80abdcdb38..7605d066ddf 100644 --- a/spec/finders/keys_finder_spec.rb +++ b/spec/finders/keys_finder_spec.rb @@ -73,7 +73,15 @@ describe KeysFinder do end context 'with valid fingerprints' do - context 'with valid MD5 params' do + let!(:deploy_key) do + create(:deploy_key, + user: user, + key: 'ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt1017k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=', + fingerprint: '8a:4a:12:92:0b:50:47:02:d4:5a:8e:a9:44:4e:08:b4', + fingerprint_sha256: '4DPHOVNh53i9dHb5PpY2vjfyf5qniTx1/pBFPoZLDdk') + end + + context 'personal key with valid MD5 params' do context 'with an existent fingerprint' do before do params[:fingerprint] = 'ba:81:59:68:d7:6c:cd:02:02:bf:6a:9b:55:4e:af:d1' @@ -85,6 +93,17 @@ describe KeysFinder do end end + context 'deploy key with an existent fingerprint' do + before do + params[:fingerprint] = '8a:4a:12:92:0b:50:47:02:d4:5a:8e:a9:44:4e:08:b4' + end + + it 'returns the key' do + expect(subject).to eq(deploy_key) + expect(subject.user).to eq(user) + end + end + context 'with a non-existent fingerprint' do before do params[:fingerprint] = 'bb:81:59:68:d7:6c:cd:02:02:bf:6a:9b:55:4e:af:d2' @@ -96,7 +115,7 @@ describe KeysFinder do end end - context 'with valid SHA256 params' do + context 'personal key with valid SHA256 params' do context 'with an existent fingerprint' do before do params[:fingerprint] = 'SHA256:nUhzNyftwADy8AH3wFY31tAKs7HufskYTte2aXo/lCg' @@ -108,6 +127,17 @@ describe KeysFinder do end end + context 'deploy key with an existent fingerprint' do + before do + params[:fingerprint] = 'SHA256:4DPHOVNh53i9dHb5PpY2vjfyf5qniTx1/pBFPoZLDdk' + end + + it 'returns key' do + expect(subject).to eq(deploy_key) + expect(subject.user).to eq(user) + end + end + context 'with a non-existent fingerprint' do before do params[:fingerprint] = 'SHA256:xTjuFqftwADy8AH3wFY31tAKs7HufskYTte2aXi/mNp' |