Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-09-20 14:18:08 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-09-20 14:18:08 +0300
commit5afcbe03ead9ada87621888a31a62652b10a7e4f (patch)
tree9918b67a0d0f0bafa6542e839a8be37adf73102d /spec/lib/gitlab/x509/tag_spec.rb
parentc97c0201564848c1f53226fe19d71fdcc472f7d0 (diff)
Add latest changes from gitlab-org/gitlab@16-4-stable-eev16.4.0-rc42
Diffstat (limited to 'spec/lib/gitlab/x509/tag_spec.rb')
-rw-r--r--spec/lib/gitlab/x509/tag_spec.rb27
1 files changed, 15 insertions, 12 deletions
diff --git a/spec/lib/gitlab/x509/tag_spec.rb b/spec/lib/gitlab/x509/tag_spec.rb
index e20ef688db5..4368c3d7a4b 100644
--- a/spec/lib/gitlab/x509/tag_spec.rb
+++ b/spec/lib/gitlab/x509/tag_spec.rb
@@ -1,15 +1,24 @@
# frozen_string_literal: true
require 'spec_helper'
-RSpec.describe Gitlab::X509::Tag do
- subject(:signature) { described_class.new(project.repository, tag).signature }
-
+RSpec.describe Gitlab::X509::Tag, feature_category: :source_code_management do
describe '#signature' do
- let_it_be(:project) { create(:project, :repository) }
- let_it_be(:repository) { project.repository.raw }
+ let(:tag_id) { 'v1.1.1' }
+ let(:tag) { instance_double('Gitlab::Git::Tag') }
+ let_it_be(:user) { create(:user, email: X509Helpers::User1.tag_email) }
+ let_it_be(:project) { create(:project, path: X509Helpers::User1.path, creator: user) }
+ let(:signature) { described_class.new(project.repository, tag).signature }
+
+ before do
+ allow(tag).to receive(:id).and_return(tag_id)
+ allow(tag).to receive(:has_signature?).and_return(true)
+ allow(tag).to receive(:user_email).and_return(user.email)
+ allow(tag).to receive(:date).and_return(X509Helpers::User1.signed_tag_time)
+ allow(Gitlab::Git::Tag).to receive(:extract_signature_lazily).with(project.repository, tag_id)
+ .and_return([X509Helpers::User1.signed_tag_signature, X509Helpers::User1.signed_tag_base_data])
+ end
describe 'signed tag' do
- let(:tag) { project.repository.find_tag('v1.1.1') }
let(:certificate_attributes) do
{
subject_key_identifier: X509Helpers::User1.tag_certificate_subject_key_identifier,
@@ -32,11 +41,5 @@ RSpec.describe Gitlab::X509::Tag do
it { expect(signature.x509_certificate).to have_attributes(certificate_attributes) }
it { expect(signature.x509_certificate.x509_issuer).to have_attributes(issuer_attributes) }
end
-
- describe 'unsigned tag' do
- let(:tag) { project.repository.find_tag('v1.0.0') }
-
- it { expect(signature).to be_nil }
- end
end
end