Merge pull request #169 from apenney/fix_ppa.pp
[puppet-modules/puppetlabs-apt.git] / spec / system / apt_key_spec.rb
1 require 'spec_helper_system'
2
3 describe 'apt::key' do
4
5   context 'reset' do
6     it 'clean up keys' do
7       shell('apt-key del 4BD6EC30')
8       shell('apt-key del D50582E6')
9     end
10   end
11
12   context 'apt::key' do
13     it 'should work with no errors' do
14       pp = <<-EOS
15       include '::apt'
16       apt::key { 'puppetlabs':
17         key        => '4BD6EC30',
18         key_server => 'pgp.mit.edu',
19       }
20
21       apt::key { 'jenkins':
22         key        => 'D50582E6',
23         key_source => 'http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key',
24       }
25       EOS
26
27       puppet_apply(pp) do |r|
28         r.exit_code.should_not == 1
29       end
30     end
31
32     describe 'keys should exist' do
33       it 'finds puppetlabs key' do
34         shell('apt-key list | grep 4BD6EC30') do |r|
35           r.exit_code.should be_zero
36         end
37       end
38       it 'finds jenkins key' do
39         shell('apt-key list | grep D50582E6') do |r|
40           r.exit_code.should be_zero
41         end
42       end
43     end
44   end
45
46   context 'reset' do
47     it 'clean up keys' do
48       shell('apt-key del 4BD6EC30')
49       shell('apt-key del D50582E6')
50     end
51   end
52
53 end