diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-03 18:10:03 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-03 18:10:03 +0000 |
commit | b6847c621ff246e6abceb90545d5a608318762d6 (patch) | |
tree | 460da2a6c2be2e4f5164c2bba1851b66260f850d /spec/requests | |
parent | c08d9c22569d1c9e7c7737e183969593394133d9 (diff) | |
download | gitlab-ce-b6847c621ff246e6abceb90545d5a608318762d6.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/commits_spec.rb | 28 | ||||
-rw-r--r-- | spec/requests/api/discussions_spec.rb | 2 |
2 files changed, 27 insertions, 3 deletions
diff --git a/spec/requests/api/commits_spec.rb b/spec/requests/api/commits_spec.rb index 4b110874df0..86b3dd4095f 100644 --- a/spec/requests/api/commits_spec.rb +++ b/spec/requests/api/commits_spec.rb @@ -1889,11 +1889,11 @@ describe API::Commits do context 'unsigned commit' do it_behaves_like '404 response' do let(:request) { get api(route, current_user) } - let(:message) { '404 GPG Signature Not Found'} + let(:message) { '404 Signature Not Found'} end end - context 'signed commit' do + context 'gpg signed commit' do let(:commit) { project.repository.commit(GpgHelpers::SIGNED_COMMIT_SHA) } let(:commit_id) { commit.id } @@ -1901,11 +1901,35 @@ describe API::Commits do get api(route, current_user) expect(response).to have_gitlab_http_status(:ok) + expect(json_response['signature_type']).to eq('PGP') expect(json_response['gpg_key_id']).to eq(commit.signature.gpg_key_id) expect(json_response['gpg_key_subkey_id']).to eq(commit.signature.gpg_key_subkey_id) expect(json_response['gpg_key_primary_keyid']).to eq(commit.signature.gpg_key_primary_keyid) expect(json_response['verification_status']).to eq(commit.signature.verification_status) end end + + context 'x509 signed commit' do + let(:commit) { project.repository.commit_by(oid: '189a6c924013fc3fe40d6f1ec1dc20214183bc97') } + let(:commit_id) { commit.id } + + it 'returns correct JSON' do + get api(route, current_user) + + expect(response).to have_gitlab_http_status(:ok) + expect(json_response['signature_type']).to eq('X509') + expect(json_response['verification_status']).to eq(commit.signature.verification_status) + expect(json_response['x509_certificate']['id']).to eq(commit.signature.x509_certificate.id) + expect(json_response['x509_certificate']['subject']).to eq(commit.signature.x509_certificate.subject) + expect(json_response['x509_certificate']['subject_key_identifier']).to eq(commit.signature.x509_certificate.subject_key_identifier) + expect(json_response['x509_certificate']['email']).to eq(commit.signature.x509_certificate.email) + expect(json_response['x509_certificate']['serial_number']).to eq(commit.signature.x509_certificate.serial_number) + expect(json_response['x509_certificate']['certificate_status']).to eq(commit.signature.x509_certificate.certificate_status) + expect(json_response['x509_certificate']['x509_issuer']['id']).to eq(commit.signature.x509_certificate.x509_issuer.id) + expect(json_response['x509_certificate']['x509_issuer']['subject']).to eq(commit.signature.x509_certificate.x509_issuer.subject) + expect(json_response['x509_certificate']['x509_issuer']['subject_key_identifier']).to eq(commit.signature.x509_certificate.x509_issuer.subject_key_identifier) + expect(json_response['x509_certificate']['x509_issuer']['crl_url']).to eq(commit.signature.x509_certificate.x509_issuer.crl_url) + end + end end end diff --git a/spec/requests/api/discussions_spec.rb b/spec/requests/api/discussions_spec.rb index e4dd6dfbeff..cb3efb2cf5f 100644 --- a/spec/requests/api/discussions_spec.rb +++ b/spec/requests/api/discussions_spec.rb @@ -31,7 +31,7 @@ describe API::Discussions do context 'when noteable is a Snippet' do let!(:snippet) { create(:project_snippet, project: project, author: user) } - let!(:snippet_note) { create(:discussion_note_on_snippet, noteable: snippet, project: project, author: user) } + let!(:snippet_note) { create(:discussion_note_on_project_snippet, noteable: snippet, project: project, author: user) } it_behaves_like 'discussions API', 'projects', 'snippets', 'id' do let(:parent) { project } |