summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/gpg_spec.rb
diff options
context:
space:
mode:
authorAlexis Reigel <mail@koffeinfrei.org>2017-02-22 18:36:25 +0100
committerAlexis Reigel <mail@koffeinfrei.org>2017-07-27 15:40:41 +0200
commit87c0fd34557463528a552986a42f4ebb52d3bd56 (patch)
tree18b35c83421e8a96d4ec49bc248750d9d536b58c /spec/lib/gitlab/gpg_spec.rb
parente34cef0cd2fcf9a01d3f3b6dd215bbcc25d65d27 (diff)
downloadgitlab-ce-87c0fd34557463528a552986a42f4ebb52d3bd56.tar.gz
add / remove gpg keys to / from system keychain
Diffstat (limited to 'spec/lib/gitlab/gpg_spec.rb')
-rw-r--r--spec/lib/gitlab/gpg_spec.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/spec/lib/gitlab/gpg_spec.rb b/spec/lib/gitlab/gpg_spec.rb
index a59302e6738..2f779492c24 100644
--- a/spec/lib/gitlab/gpg_spec.rb
+++ b/spec/lib/gitlab/gpg_spec.rb
@@ -15,6 +15,24 @@ describe Gitlab::Gpg do
end
end
- describe '.add_to_keychain' do
+ describe '.add_to_keychain', :gpg do
+ it 'stores the key in the keychain' do
+ expect(GPGME::Key.find(:public, '4F4840A503964251CF7D7F5DC728AF10972E97C0')).to eq []
+
+ Gitlab::Gpg.add_to_keychain(GpgHelpers.public_key)
+
+ expect(GPGME::Key.find(:public, '4F4840A503964251CF7D7F5DC728AF10972E97C0')).not_to eq []
+ end
+ end
+
+ describe '.remove_from_keychain', :gpg do
+ it 'removes the key from the keychain' do
+ Gitlab::Gpg.add_to_keychain(GpgHelpers.public_key)
+ expect(GPGME::Key.find(:public, '4F4840A503964251CF7D7F5DC728AF10972E97C0')).not_to eq []
+
+ Gitlab::Gpg.remove_from_keychain('4F4840A503964251CF7D7F5DC728AF10972E97C0')
+
+ expect(GPGME::Key.find(:public, '4F4840A503964251CF7D7F5DC728AF10972E97C0')).to eq []
+ end
end
end