3 describe 'apache::mod::wsgi', :type => :class do
7 context "on a Debian OS" do
10 :osfamily => 'Debian',
11 :operatingsystemrelease => '6',
12 :concat_basedir => '/dne',
13 :lsbdistcodename => 'squeeze',
14 :operatingsystem => 'Debian',
17 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
21 it { is_expected.to contain_class("apache::params") }
22 it { is_expected.to contain_class('apache::mod::wsgi').with(
23 'wsgi_socket_prefix' => nil
26 it { is_expected.to contain_package("libapache2-mod-wsgi") }
28 context "on a RedHat OS" do
31 :osfamily => 'RedHat',
32 :operatingsystemrelease => '6',
33 :concat_basedir => '/dne',
34 :operatingsystem => 'RedHat',
37 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
41 it { is_expected.to contain_class("apache::params") }
42 it { is_expected.to contain_class('apache::mod::wsgi').with(
43 'wsgi_socket_prefix' => '/var/run/wsgi'
46 it { is_expected.to contain_package("mod_wsgi") }
48 describe "with custom WSGISocketPrefix" do
50 { :wsgi_socket_prefix => 'run/wsgi' }
52 it {is_expected.to contain_file('wsgi.conf').with_content(/^ WSGISocketPrefix run\/wsgi$/)}
54 describe "with custom WSGIPythonHome" do
56 { :wsgi_python_home => '/path/to/virtenv' }
58 it {is_expected.to contain_file('wsgi.conf').with_content(/^ WSGIPythonHome "\/path\/to\/virtenv"$/)}
60 describe "with custom package_name and mod_path" do
63 :package_name => 'mod_wsgi_package',
64 :mod_path => '/foo/bar/baz',
67 it { is_expected.to contain_apache__mod('wsgi').with({
68 'package' => 'mod_wsgi_package',
69 'path' => '/foo/bar/baz',
72 it { is_expected.to contain_package("mod_wsgi_package") }
73 it { is_expected.to contain_file('wsgi.load').with_content(%r"LoadModule wsgi_module /foo/bar/baz") }
75 describe "with custom mod_path not containing /" do
78 :package_name => 'mod_wsgi_package',
79 :mod_path => 'wsgi_mod_name.so',
82 it { is_expected.to contain_apache__mod('wsgi').with({
83 'path' => 'modules/wsgi_mod_name.so',
84 'package' => 'mod_wsgi_package',
87 it { is_expected.to contain_file('wsgi.load').with_content(%r"LoadModule wsgi_module modules/wsgi_mod_name.so") }
90 describe "with package_name but no mod_path" do
93 :mod_path => '/foo/bar/baz',
96 it { expect { catalogue }.to raise_error Puppet::Error, /apache::mod::wsgi - both package_name and mod_path must be specified!/ }
98 describe "with mod_path but no package_name" do
101 :package_name => '/foo/bar/baz',
104 it { expect { catalogue }.to raise_error Puppet::Error, /apache::mod::wsgi - both package_name and mod_path must be specified!/ }
107 context "on a FreeBSD OS" do
110 :osfamily => 'FreeBSD',
111 :operatingsystemrelease => '9',
112 :concat_basedir => '/dne',
113 :operatingsystem => 'FreeBSD',
115 :kernel => 'FreeBSD',
116 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
120 it { is_expected.to contain_class("apache::params") }
121 it { is_expected.to contain_class('apache::mod::wsgi').with(
122 'wsgi_socket_prefix' => nil
125 it { is_expected.to contain_package("www/mod_wsgi") }
127 context "on a Gentoo OS" do
130 :osfamily => 'Gentoo',
131 :operatingsystem => 'Gentoo',
132 :operatingsystemrelease => '3.16.1-gentoo',
133 :concat_basedir => '/dne',
136 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin',
140 it { is_expected.to contain_class("apache::params") }
141 it { is_expected.to contain_class('apache::mod::wsgi').with(
142 'wsgi_socket_prefix' => nil
145 it { is_expected.to contain_package("www-apache/mod_wsgi") }