Commit eb77e106 authored by Alexis Reigel's avatar Alexis Reigel

add second gpg key for specs

parent 87c0fd34
...@@ -2,6 +2,6 @@ require_relative '../support/gpg_helpers' ...@@ -2,6 +2,6 @@ require_relative '../support/gpg_helpers'
FactoryGirl.define do FactoryGirl.define do
factory :gpg_key do factory :gpg_key do
key GpgHelpers.public_key key GpgHelpers::User1.public_key
end end
end end
...@@ -4,7 +4,7 @@ describe Gitlab::Gpg do ...@@ -4,7 +4,7 @@ describe Gitlab::Gpg do
describe '.fingerprints_from_key' do describe '.fingerprints_from_key' do
it 'returns the fingerprint' do it 'returns the fingerprint' do
expect( expect(
described_class.fingerprints_from_key(GpgHelpers.public_key) described_class.fingerprints_from_key(GpgHelpers::User1.public_key)
).to eq ['4F4840A503964251CF7D7F5DC728AF10972E97C0'] ).to eq ['4F4840A503964251CF7D7F5DC728AF10972E97C0']
end end
...@@ -19,7 +19,7 @@ describe Gitlab::Gpg do ...@@ -19,7 +19,7 @@ describe Gitlab::Gpg do
it 'stores the key in the keychain' do it 'stores the key in the keychain' do
expect(GPGME::Key.find(:public, '4F4840A503964251CF7D7F5DC728AF10972E97C0')).to eq [] expect(GPGME::Key.find(:public, '4F4840A503964251CF7D7F5DC728AF10972E97C0')).to eq []
Gitlab::Gpg.add_to_keychain(GpgHelpers.public_key) Gitlab::Gpg.add_to_keychain(GpgHelpers::User1.public_key)
expect(GPGME::Key.find(:public, '4F4840A503964251CF7D7F5DC728AF10972E97C0')).not_to eq [] expect(GPGME::Key.find(:public, '4F4840A503964251CF7D7F5DC728AF10972E97C0')).not_to eq []
end end
...@@ -27,7 +27,7 @@ describe Gitlab::Gpg do ...@@ -27,7 +27,7 @@ describe Gitlab::Gpg do
describe '.remove_from_keychain', :gpg do describe '.remove_from_keychain', :gpg do
it 'removes the key from the keychain' do it 'removes the key from the keychain' do
Gitlab::Gpg.add_to_keychain(GpgHelpers.public_key) Gitlab::Gpg.add_to_keychain(GpgHelpers::User1.public_key)
expect(GPGME::Key.find(:public, '4F4840A503964251CF7D7F5DC728AF10972E97C0')).not_to eq [] expect(GPGME::Key.find(:public, '4F4840A503964251CF7D7F5DC728AF10972E97C0')).not_to eq []
Gitlab::Gpg.remove_from_keychain('4F4840A503964251CF7D7F5DC728AF10972E97C0') Gitlab::Gpg.remove_from_keychain('4F4840A503964251CF7D7F5DC728AF10972E97C0')
......
...@@ -422,11 +422,11 @@ eos ...@@ -422,11 +422,11 @@ eos
context 'signed commit', :gpg do context 'signed commit', :gpg do
it 'returns a valid signature if the public key is known' do it 'returns a valid signature if the public key is known' do
GPGME::Key.import(GpgHelpers.public_key) GPGME::Key.import(GpgHelpers::User1.public_key)
raw_commit = double(:raw_commit, signature: [ raw_commit = double(:raw_commit, signature: [
GpgHelpers.signed_commit_signature, GpgHelpers::User1.signed_commit_signature,
GpgHelpers.signed_commit_base_data GpgHelpers::User1.signed_commit_base_data
]) ])
allow(raw_commit).to receive :save! allow(raw_commit).to receive :save!
...@@ -440,8 +440,8 @@ eos ...@@ -440,8 +440,8 @@ eos
it 'returns an invalid signature if the public commit is unknown', :gpg do it 'returns an invalid signature if the public commit is unknown', :gpg do
raw_commit = double(:raw_commit, signature: [ raw_commit = double(:raw_commit, signature: [
GpgHelpers.signed_commit_signature, GpgHelpers::User1.signed_commit_signature,
GpgHelpers.signed_commit_base_data GpgHelpers::User1.signed_commit_base_data
]) ])
allow(raw_commit).to receive :save! allow(raw_commit).to receive :save!
......
...@@ -16,7 +16,7 @@ describe GpgKey do ...@@ -16,7 +16,7 @@ describe GpgKey do
context 'callbacks', :gpg do context 'callbacks', :gpg do
describe 'extract_fingerprint' do describe 'extract_fingerprint' do
it 'extracts the fingerprint from the gpg key' do it 'extracts the fingerprint from the gpg key' do
gpg_key = described_class.new(key: GpgHelpers.public_key) gpg_key = described_class.new(key: GpgHelpers::User1.public_key)
gpg_key.valid? gpg_key.valid?
expect(gpg_key.fingerprint).to eq '4F4840A503964251CF7D7F5DC728AF10972E97C0' expect(gpg_key.fingerprint).to eq '4F4840A503964251CF7D7F5DC728AF10972E97C0'
end end
...@@ -24,7 +24,7 @@ describe GpgKey do ...@@ -24,7 +24,7 @@ describe GpgKey do
describe 'add_to_keychain' do describe 'add_to_keychain' do
it 'calls add_to_keychain after create' do it 'calls add_to_keychain after create' do
expect(Gitlab::Gpg).to receive(:add_to_keychain).with(GpgHelpers.public_key) expect(Gitlab::Gpg).to receive(:add_to_keychain).with(GpgHelpers::User1.public_key)
create :gpg_key create :gpg_key
end end
end end
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment