From 58c24bfd724fd1146b40e0ec248b230d7b6389d8 Mon Sep 17 00:00:00 2001 From: Daniel Lawrence Date: Sun, 27 Jul 2014 21:09:08 +1000 Subject: started adding checks for python::requirements --- spec/defines/requirements_spec.rb | 53 +++++++++++++++++++++++++++++++++++++ spec/defines/requirements_spec.rb~ | 54 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 spec/defines/requirements_spec.rb create mode 100644 spec/defines/requirements_spec.rb~ (limited to 'spec/defines') diff --git a/spec/defines/requirements_spec.rb b/spec/defines/requirements_spec.rb new file mode 100644 index 0000000..f8144f3 --- /dev/null +++ b/spec/defines/requirements_spec.rb @@ -0,0 +1,53 @@ +require_relative '../../spec_helper' + +describe 'python::requirements', :type => :define do + let (:title) { '/requirements.txt' } + 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 + + describe "requirements as" do + context "/requirements.txt" do + let (:params) {{ :requirements => "/requirements.txt" }} + it { is_expected.to contain_file("/requirements.txt").with( + "mode" => "0644" + + )} + end + + describe "with owner" do + context "bob:bob" do + let (:params) {{ + :owner => 'bob', + :group => 'bob' + }} + it do + expect { + should compile + }.to raise_error(Puppet::Error, /root user must be used when virtualenv is system/) + end + + end + end + + describe "with owner" do + context "default" do + it { is_expected.to contain_file("/requirements.txt").with( + "owner" => "root", + "group" => "root" + )} + end + end + end + end +end diff --git a/spec/defines/requirements_spec.rb~ b/spec/defines/requirements_spec.rb~ new file mode 100644 index 0000000..62a8254 --- /dev/null +++ b/spec/defines/requirements_spec.rb~ @@ -0,0 +1,54 @@ +require_relative '../../spec_helper' + +describe 'python::requirements', :type => :define 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 + + describe "requirements as" do + context "/requirements.txt" do + let (:params) {{ :requirements => "/requirements.txt" }} + it { is_expected.to contain_file("/requirements.txt").with( + "mode" => "0644" + + )} + end + + describe "with owner" do + context "bob:bob" do + let (:params) {{ + :owner => 'bob', + :group => 'bob' + }} + it { is_expected.to contain_file("/requirements.txt").with( + "owner" => "bob", + "group" => "bob" + )} + end + end + + describe "with owner" do + context "default" do + let (:params) {{ + :owner => '', + :group => '' + }} + it { is_expected.to contain_file("/requirements.txt").with( + "owner" => "root", + "group" => "root" + )} + end + end + end + end +end -- cgit v1.2.3 From 62be88b026e19e1750deaf5cf81b3f9519ff651a Mon Sep 17 00:00:00 2001 From: Daniel Lawrence Date: Sun, 27 Jul 2014 21:12:10 +1000 Subject: removed tmp files --- spec/defines/requirements_spec.rb~ | 54 -------------------------------------- 1 file changed, 54 deletions(-) delete mode 100644 spec/defines/requirements_spec.rb~ (limited to 'spec/defines') diff --git a/spec/defines/requirements_spec.rb~ b/spec/defines/requirements_spec.rb~ deleted file mode 100644 index 62a8254..0000000 --- a/spec/defines/requirements_spec.rb~ +++ /dev/null @@ -1,54 +0,0 @@ -require_relative '../../spec_helper' - -describe 'python::requirements', :type => :define 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 - - describe "requirements as" do - context "/requirements.txt" do - let (:params) {{ :requirements => "/requirements.txt" }} - it { is_expected.to contain_file("/requirements.txt").with( - "mode" => "0644" - - )} - end - - describe "with owner" do - context "bob:bob" do - let (:params) {{ - :owner => 'bob', - :group => 'bob' - }} - it { is_expected.to contain_file("/requirements.txt").with( - "owner" => "bob", - "group" => "bob" - )} - end - end - - describe "with owner" do - context "default" do - let (:params) {{ - :owner => '', - :group => '' - }} - it { is_expected.to contain_file("/requirements.txt").with( - "owner" => "root", - "group" => "root" - )} - end - end - end - end -end -- cgit v1.2.3