]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/apache/spec/classes/mod/authnz_ldap_spec.rb
add Openstack modules to 3rdparty
[dsa-puppet.git] / 3rdparty / modules / apache / spec / classes / mod / authnz_ldap_spec.rb
1 require 'spec_helper'
2
3 describe 'apache::mod::authnz_ldap', :type => :class do
4   let :pre_condition do
5     'include apache'
6   end
7
8   context "on a Debian OS" do
9     let :facts do
10       {
11         :lsbdistcodename        => 'squeeze',
12         :osfamily               => 'Debian',
13         :operatingsystemrelease => '6',
14         :concat_basedir         => '/dne',
15         :id                     => 'root',
16         :kernel                 => 'Linux',
17         :operatingsystem        => 'Debian',
18         :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
19         :is_pe                  => false,
20       }
21     end
22     it { is_expected.to contain_class("apache::params") }
23     it { is_expected.to contain_class("apache::mod::ldap") }
24     it { is_expected.to contain_apache__mod('authnz_ldap') }
25
26     context 'default verifyServerCert' do
27       it { is_expected.to contain_file('authnz_ldap.conf').with_content(/^LDAPVerifyServerCert On$/) }
28     end
29
30     context 'verifyServerCert = false' do
31       let(:params) { { :verifyServerCert => false } }
32       it { is_expected.to contain_file('authnz_ldap.conf').with_content(/^LDAPVerifyServerCert Off$/) }
33     end
34
35     context 'verifyServerCert = wrong' do
36       let(:params) { { :verifyServerCert => 'wrong' } }
37       it 'should raise an error' do
38         expect { is_expected.to raise_error Puppet::Error }
39       end
40     end
41   end #Debian
42
43   context "on a RedHat OS" do
44     let :facts do
45       {
46         :osfamily               => 'RedHat',
47         :operatingsystemrelease => '6',
48         :concat_basedir         => '/dne',
49         :id                     => 'root',
50         :kernel                 => 'Linux',
51         :operatingsystem        => 'RedHat',
52         :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
53         :is_pe                  => false,
54       }
55     end
56     it { is_expected.to contain_class("apache::params") }
57     it { is_expected.to contain_class("apache::mod::ldap") }
58     it { is_expected.to contain_apache__mod('authnz_ldap') }
59
60     context 'default verifyServerCert' do
61       it { is_expected.to contain_file('authnz_ldap.conf').with_content(/^LDAPVerifyServerCert On$/) }
62     end
63
64     context 'verifyServerCert = false' do
65       let(:params) { { :verifyServerCert => false } }
66       it { is_expected.to contain_file('authnz_ldap.conf').with_content(/^LDAPVerifyServerCert Off$/) }
67     end
68
69     context 'verifyServerCert = wrong' do
70       let(:params) { { :verifyServerCert => 'wrong' } }
71       it 'should raise an error' do
72         expect { is_expected.to raise_error Puppet::Error }
73       end
74     end
75   end # Redhat
76
77 end
78