comparison modules/apache/spec/classes/mod/authnz_ldap_spec.rb @ 257:675c1cc61eaf

Update Apache module to get CentOS 8 support Unfortunately it only fixes some bits. mod_wsgi still needs other approaches This also overrides the vhost modification to make them come last in the import order (after module loading)
author IBBoard <dev@ibboard.co.uk>
date Sun, 22 Dec 2019 14:43:29 -0500
parents 37675581a273
children d9352a684e62
comparison
equal deleted inserted replaced
252:47750947f4dc 257:675c1cc61eaf
1 require 'spec_helper' 1 require 'spec_helper'
2 2
3 describe 'apache::mod::authnz_ldap', :type => :class do 3 describe 'apache::mod::authnz_ldap', :type => :class do
4 let :pre_condition do 4 it_behaves_like "a mod class, without including apache"
5 'include apache' 5
6 context "default configuration with parameters" do
7 context "on a Debian OS" do
8 let :facts do
9 {
10 :lsbdistcodename => 'squeeze',
11 :osfamily => 'Debian',
12 :operatingsystemrelease => '6',
13 :concat_basedir => '/dne',
14 :id => 'root',
15 :kernel => 'Linux',
16 :operatingsystem => 'Debian',
17 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
18 :is_pe => false,
19 }
20 end
21 it { is_expected.to contain_class("apache::params") }
22 it { is_expected.to contain_class("apache::mod::ldap") }
23 it { is_expected.to contain_apache__mod('authnz_ldap') }
24
25 context 'default verify_server_cert' do
26 it { is_expected.to contain_file('authnz_ldap.conf').with_content(/^LDAPVerifyServerCert On$/) }
27 end
28
29 context 'verify_server_cert = false' do
30 let(:params) { { :verify_server_cert => false } }
31 it { is_expected.to contain_file('authnz_ldap.conf').with_content(/^LDAPVerifyServerCert Off$/) }
32 end
33
34 context 'verify_server_cert = wrong' do
35 let(:params) { { :verify_server_cert => 'wrong' } }
36 it 'should raise an error' do
37 expect { is_expected.to raise_error Puppet::Error }
38 end
39 end
40 end #Debian
41
42 context "on a RedHat OS" do
43 let :facts do
44 {
45 :osfamily => 'RedHat',
46 :operatingsystemrelease => '6',
47 :concat_basedir => '/dne',
48 :id => 'root',
49 :kernel => 'Linux',
50 :operatingsystem => 'RedHat',
51 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
52 :is_pe => false,
53 }
54 end
55 it { is_expected.to contain_class("apache::params") }
56 it { is_expected.to contain_class("apache::mod::ldap") }
57 it { is_expected.to contain_apache__mod('authnz_ldap') }
58
59 context 'default verify_server_cert' do
60 it { is_expected.to contain_file('authnz_ldap.conf').with_content(/^LDAPVerifyServerCert On$/) }
61 end
62
63 context 'verify_server_cert = false' do
64 let(:params) { { :verify_server_cert => false } }
65 it { is_expected.to contain_file('authnz_ldap.conf').with_content(/^LDAPVerifyServerCert Off$/) }
66 end
67
68 context 'verify_server_cert = wrong' do
69 let(:params) { { :verify_server_cert => 'wrong' } }
70 it 'should raise an error' do
71 expect { is_expected.to raise_error Puppet::Error }
72 end
73 end
74 end # Redhat
6 end 75 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 76 end
78