summaryrefslogtreecommitdiff
path: root/spec/classes/python_spec.rb
blob: af94b70e0812e8ac69d894ad4a81b94e08571739 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
require_relative '../../spec_helper'

describe 'python', :type => :class do
  context "on Debian OS" do
    let :facts do
      {
        :id                     => 'root',
        :kernel                 => 'Linux',
        :lsbdistcodename        => 'squeeze',
        :osfamily               => 'Debian',
        :operatingsystem        => 'Debian',
        :operatingsystemrelease => '6',
        :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
        :concat_basedir         => '/dne',
      }
    end

    it { is_expected.to contain_class("python::install") }
    # Base debian packages.
    it { is_expected.to contain_package("python") }
    it { is_expected.to contain_package("python-dev") }
    it { is_expected.to contain_package("python-pip") }
    # Basic python packages (from pip)
    it { is_expected.to contain_package("python-virtualenv")}
    
    describe "with manage_gunicorn" do
      context "true" do
        let (:params) {{ :manage_gunicorn => true }} 
        it { is_expected.to contain_package("gunicorn") }
      end
    end
    describe "with manage_gunicorn" do
      context "empty args" do
        #let (:params) {{ :manage_gunicorn => '' }} 
        it { is_expected.to contain_package("gunicorn") }
      end
    end
    
    describe "without mange_gunicorn" do
      context "false" do
        let (:params) {{ :manage_gunicorn => false }} 
        it {is_expected.not_to contain_package("gunicorn")}
      end
    end

  end
  
  context "on a Redhat 5 OS" do
    let :facts do
      {
        :id => 'root',
        :kernel => 'Linux',
        :osfamily => 'RedHat',
        :operatingsystem => 'RedHat',
        :operatingsystemrelease => '5',
        :concat_basedir => '/dne',
        :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
      }
    end
    it { is_expected.to contain_class("python::install") }
    # Base debian packages.
    it { is_expected.to contain_package("python") }
    it { is_expected.to contain_package("python-devel") }
    it { is_expected.to contain_package("python-pip") }
    # Basic python packages (from pip)
    it { is_expected.to contain_package("python-virtualenv")}

  end

end