diff options
Diffstat (limited to 'spec/lib/gitlab/x509')
-rw-r--r-- | spec/lib/gitlab/x509/signature_spec.rb | 14 | ||||
-rw-r--r-- | spec/lib/gitlab/x509/tag_spec.rb | 4 |
2 files changed, 16 insertions, 2 deletions
diff --git a/spec/lib/gitlab/x509/signature_spec.rb b/spec/lib/gitlab/x509/signature_spec.rb index 5626e49bfe1..31f66232f38 100644 --- a/spec/lib/gitlab/x509/signature_spec.rb +++ b/spec/lib/gitlab/x509/signature_spec.rb @@ -30,6 +30,20 @@ RSpec.describe Gitlab::X509::Signature do expect(signature.verification_status).to eq(:verified) end + it 'returns a verified signature if email does match, case-insensitively' do + signature = described_class.new( + X509Helpers::User1.signed_commit_signature, + X509Helpers::User1.signed_commit_base_data, + X509Helpers::User1.certificate_email.upcase, + X509Helpers::User1.signed_commit_time + ) + + expect(signature.x509_certificate).to have_attributes(certificate_attributes) + expect(signature.x509_certificate.x509_issuer).to have_attributes(issuer_attributes) + expect(signature.verified_signature).to be_truthy + expect(signature.verification_status).to eq(:verified) + end + context "if the email matches but isn't confirmed" do let!(:user) { create(:user, :unconfirmed, email: X509Helpers::User1.certificate_email) } diff --git a/spec/lib/gitlab/x509/tag_spec.rb b/spec/lib/gitlab/x509/tag_spec.rb index f52880cfc52..e20ef688db5 100644 --- a/spec/lib/gitlab/x509/tag_spec.rb +++ b/spec/lib/gitlab/x509/tag_spec.rb @@ -5,8 +5,8 @@ RSpec.describe Gitlab::X509::Tag do subject(:signature) { described_class.new(project.repository, tag).signature } describe '#signature' do - let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '', 'group/project') } - let(:project) { create(:project, :repository) } + let_it_be(:project) { create(:project, :repository) } + let_it_be(:repository) { project.repository.raw } describe 'signed tag' do let(:tag) { project.repository.find_tag('v1.1.1') } |