summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lawrence <dannyla@linux.com>2014-07-27 20:44:36 +1000
committerDaniel Lawrence <dannyla@linux.com>2014-07-27 20:44:36 +1000
commit3f9c7dd32c500906a17a4729dc5418e354f19786 (patch)
tree523c87b8e685b4ddcf20a274604a4ec80332ac96
parentd2270be7b845298bc2a4bd93af66953c0fdbd2f6 (diff)
increase spec coverage of puppet::install
-rw-r--r--spec/classes/python_spec.rb170
1 files changed, 164 insertions, 6 deletions
diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb
index af94b70..9552ce4 100644
--- a/spec/classes/python_spec.rb
+++ b/spec/classes/python_spec.rb
@@ -22,27 +22,96 @@ describe 'python', :type => :class do
it { is_expected.to contain_package("python-pip") }
# Basic python packages (from pip)
it { is_expected.to contain_package("python-virtualenv")}
+
+ describe "with python::dev" do
+ context "true" do
+ let (:params) {{ :dev => true }}
+ it { is_expected.to contain_package("python-dev").with(
+ "ensure" => "present")
+ }
+ end
+ context "empty/default" do
+ it { is_expected.to contain_package("python-dev").with(
+ "ensure" => "absent")
+ }
+ end
+ end
+
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
+ describe "with python::provider" do
+ context "pip" do
+ let (:params) {{ :provider => 'pip' }}
+ it { is_expected.to contain_package("virtualenv").with(
+ "provider" => "pip"
+ )}
+ it { is_expected.to contain_package("pip").with(
+ "provider" => "pip"
+ )}
+ end
+
+ # python::provider
+ context "default" do
+ let (:params) {{ :provider => '' }}
+ it { is_expected.to contain_package("python-virtualenv")}
+ it { is_expected.to contain_package("python-pip")}
+
+ describe "with python::virtualenv" do
+ context "true" do
+ let (:params) {{
+ :provider => '',
+ :virtualenv => true
+ }}
+ it { is_expected.to contain_package("python-virtualenv").with(
+ "ensure" => "present"
+ )}
+ end
+ end
+
+ describe "with python::virtualenv" do
+ context "default/empty" do
+ let (:params) {{
+ :provider => '',
+ :virtualenv => ''
+ }}
+ it { is_expected.to contain_package("python-virtualenv").with(
+ "ensure" => "absent"
+ )}
+ end
+ end
+
+
+ end
+ end
+
+ describe "with python::dev" do
+ context "true" do
+ let (:params) {{ :dev => true }}
+ it { is_expected.to contain_package("python-dev").with(
+ "ensure" => "present")
+ }
+ end
+ context "default/empty" do
+ let (:params) {{ :dev => '' }}
+ it { is_expected.to contain_package("python-dev").with(
+ "ensure" => "absent")
+ }
+ end
+
end
context "on a Redhat 5 OS" do
@@ -64,7 +133,96 @@ describe 'python', :type => :class do
it { is_expected.to contain_package("python-pip") }
# Basic python packages (from pip)
it { is_expected.to contain_package("python-virtualenv")}
+
+ describe "with python::dev" do
+ context "true" do
+ let (:params) {{ :dev => true }}
+ it { is_expected.to contain_package("python-devel").with(
+ "ensure" => "present")
+ }
+ end
+ context "empty/default" do
+ it { is_expected.to contain_package("python-devel").with(
+ "ensure" => "absent")
+ }
+ end
+ end
+
+
+ describe "with manage_gunicorn" do
+ context "true" do
+ let (:params) {{ :manage_gunicorn => true }}
+ it { is_expected.to contain_package("gunicorn") }
+ end
+ context "empty args" do
+ #let (:params) {{ :manage_gunicorn => '' }}
+ it { is_expected.to contain_package("gunicorn") }
+ end
+ context "false" do
+ let (:params) {{ :manage_gunicorn => false }}
+ it {is_expected.not_to contain_package("gunicorn")}
+ end
+ end
- end
+ describe "with python::provider" do
+ context "pip" do
+ let (:params) {{ :provider => 'pip' }}
+ it { is_expected.to contain_package("virtualenv").with(
+ "provider" => "pip"
+ )}
+ it { is_expected.to contain_package("pip").with(
+ "provider" => "pip"
+ )}
+ end
+
+ # python::provider
+ context "default" do
+ let (:params) {{ :provider => '' }}
+ it { is_expected.to contain_package("python-virtualenv")}
+ it { is_expected.to contain_package("python-pip")}
+
+ describe "with python::virtualenv" do
+ context "true" do
+ let (:params) {{
+ :provider => '',
+ :virtualenv => true
+ }}
+ it { is_expected.to contain_package("python-virtualenv").with(
+ "ensure" => "present"
+ )}
+ end
+ end
+
+ describe "with python::virtualenv" do
+ context "default/empty" do
+ let (:params) {{
+ :provider => '',
+ :virtualenv => ''
+ }}
+ it { is_expected.to contain_package("python-virtualenv").with(
+ "ensure" => "absent"
+ )}
+ end
+ end
+
+ end
+ end
+
+ describe "with python::dev" do
+ context "true" do
+ let (:params) {{ :dev => true }}
+ it { is_expected.to contain_package("python-devel").with(
+ "ensure" => "present")
+ }
+ end
+ context "default/empty" do
+ let (:params) {{ :dev => '' }}
+ it { is_expected.to contain_package("python-devel").with(
+ "ensure" => "absent")
+ }
+ end
+ end
+ end
+ end
end