|
| 1 | +require_relative '../../spec_helper' |
| 2 | + |
| 3 | +describe 'python', :type => :class do |
| 4 | + context "on Debian OS" do |
| 5 | + let :facts do |
| 6 | + { |
| 7 | + :id => 'root', |
| 8 | + :kernel => 'Linux', |
| 9 | + :lsbdistcodename => 'squeeze', |
| 10 | + :osfamily => 'Debian', |
| 11 | + :operatingsystem => 'Debian', |
| 12 | + :operatingsystemrelease => '6', |
| 13 | + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', |
| 14 | + :concat_basedir => '/dne', |
| 15 | + } |
| 16 | + end |
| 17 | + |
| 18 | + it { is_expected.to contain_class("python::install") } |
| 19 | + # Base debian packages. |
| 20 | + it { is_expected.to contain_package("python") } |
| 21 | + it { is_expected.to contain_package("python-dev") } |
| 22 | + it { is_expected.to contain_package("python-pip") } |
| 23 | + # Basic python packages (from pip) |
| 24 | + it { is_expected.to contain_package("python-virtualenv")} |
| 25 | + |
| 26 | + describe "with manage_gunicorn" do |
| 27 | + context "true" do |
| 28 | + let (:params) {{ :manage_gunicorn => true }} |
| 29 | + it { is_expected.to contain_package("gunicorn") } |
| 30 | + end |
| 31 | + end |
| 32 | + describe "with manage_gunicorn" do |
| 33 | + context "empty args" do |
| 34 | + #let (:params) {{ :manage_gunicorn => '' }} |
| 35 | + it { is_expected.to contain_package("gunicorn") } |
| 36 | + end |
| 37 | + end |
| 38 | + |
| 39 | + describe "without mange_gunicorn" do |
| 40 | + context "false" do |
| 41 | + let (:params) {{ :manage_gunicorn => false }} |
| 42 | + it {is_expected.not_to contain_package("gunicorn")} |
| 43 | + end |
| 44 | + end |
| 45 | + |
| 46 | + end |
| 47 | + |
| 48 | + context "on a Redhat 5 OS" do |
| 49 | + let :facts do |
| 50 | + { |
| 51 | + :id => 'root', |
| 52 | + :kernel => 'Linux', |
| 53 | + :osfamily => 'RedHat', |
| 54 | + :operatingsystem => 'RedHat', |
| 55 | + :operatingsystemrelease => '5', |
| 56 | + :concat_basedir => '/dne', |
| 57 | + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', |
| 58 | + } |
| 59 | + end |
| 60 | + it { is_expected.to contain_class("python::install") } |
| 61 | + # Base debian packages. |
| 62 | + it { is_expected.to contain_package("python") } |
| 63 | + it { is_expected.to contain_package("python-devel") } |
| 64 | + it { is_expected.to contain_package("python-pip") } |
| 65 | + # Basic python packages (from pip) |
| 66 | + it { is_expected.to contain_package("python-virtualenv")} |
| 67 | + |
| 68 | + end |
| 69 | + |
| 70 | +end |
0 commit comments