Tests to validate apt::{conf,backports}
[puppet-modules/puppetlabs-apt.git] / spec / classes / backports_spec.rb
1 require 'spec_helper'
2 describe 'apt::backports', :type => :class do
3
4   describe 'when turning on backports for ubuntu karmic' do
5
6     let :facts do
7       {
8         'lsbdistcodename' => 'Karmic',
9         'lsbdistid'       => 'Ubuntu'
10       }
11     end
12
13     it { should contain_apt__source('backports.list').with({
14         'location'   => 'http://old-releases.ubuntu.com/ubuntu',
15         'release'    => 'karmic-backports',
16         'repos'      => 'universe multiverse restricted',
17         'key'        => '437D05B5',
18         'key_server' => 'pgp.mit.edu',
19         'pin'        => '200',
20         'notify'     => 'Exec[apt_update]'
21       })
22     }
23   end
24
25   describe "when turning on backports for debian squeeze" do
26
27     let :facts do
28       {
29         'lsbdistcodename' => 'Squeeze',
30         'lsbdistid'       => 'Debian',
31       }
32     end
33
34     it { should contain_apt__source('backports.list').with({
35         'location'   => 'http://backports.debian.org/debian-backports',
36         'release'    => 'squeeze-backports',
37         'repos'      => 'main contrib non-free',
38         'key'        => '55BE302B',
39         'key_server' => 'pgp.mit.edu',
40         'pin'        => '200',
41         'notify'     => 'Exec[apt_update]'
42       })
43     }
44   end
45
46   describe "when turning on backports for debian squeeze but using your own mirror" do
47
48     let :facts do
49       {
50         'lsbdistcodename' => 'Squeeze',
51         'lsbdistid'       => 'Debian'
52       }
53     end
54
55     let :location do
56       'http://mirrors.example.com/debian-backports'
57     end
58
59     let :params do
60       { 'location' => location }
61     end
62
63     it { should contain_apt__source('backports.list').with({
64         'location'   => location,
65         'release'    => 'squeeze-backports',
66         'repos'      => 'main contrib non-free',
67         'key'        => '55BE302B',
68         'key_server' => 'pgp.mit.edu',
69         'pin'        => '200',
70         'notify'     => 'Exec[apt_update]'
71       })
72     }
73   end
74 end