Skip to content
This repository was archived by the owner on Oct 18, 2022. It is now read-only.

Commit 58c24bf

Browse files
started adding checks for python::requirements
1 parent 3f9c7dd commit 58c24bf

2 files changed

Lines changed: 107 additions & 0 deletions

File tree

spec/defines/requirements_spec.rb

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
require_relative '../../spec_helper'
2+
3+
describe 'python::requirements', :type => :define do
4+
let (:title) { '/requirements.txt' }
5+
context "on Debian OS" do
6+
let :facts do
7+
{
8+
:id => 'root',
9+
:kernel => 'Linux',
10+
:lsbdistcodename => 'squeeze',
11+
:osfamily => 'Debian',
12+
:operatingsystem => 'Debian',
13+
:operatingsystemrelease => '6',
14+
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
15+
:concat_basedir => '/dne',
16+
}
17+
end
18+
19+
describe "requirements as" do
20+
context "/requirements.txt" do
21+
let (:params) {{ :requirements => "/requirements.txt" }}
22+
it { is_expected.to contain_file("/requirements.txt").with(
23+
"mode" => "0644"
24+
25+
)}
26+
end
27+
28+
describe "with owner" do
29+
context "bob:bob" do
30+
let (:params) {{
31+
:owner => 'bob',
32+
:group => 'bob'
33+
}}
34+
it do
35+
expect {
36+
should compile
37+
}.to raise_error(Puppet::Error, /root user must be used when virtualenv is system/)
38+
end
39+
40+
end
41+
end
42+
43+
describe "with owner" do
44+
context "default" do
45+
it { is_expected.to contain_file("/requirements.txt").with(
46+
"owner" => "root",
47+
"group" => "root"
48+
)}
49+
end
50+
end
51+
end
52+
end
53+
end

spec/defines/requirements_spec.rb~

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
require_relative '../../spec_helper'
2+
3+
describe 'python::requirements', :type => :define 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+
describe "requirements as" do
19+
context "/requirements.txt" do
20+
let (:params) {{ :requirements => "/requirements.txt" }}
21+
it { is_expected.to contain_file("/requirements.txt").with(
22+
"mode" => "0644"
23+
24+
)}
25+
end
26+
27+
describe "with owner" do
28+
context "bob:bob" do
29+
let (:params) {{
30+
:owner => 'bob',
31+
:group => 'bob'
32+
}}
33+
it { is_expected.to contain_file("/requirements.txt").with(
34+
"owner" => "bob",
35+
"group" => "bob"
36+
)}
37+
end
38+
end
39+
40+
describe "with owner" do
41+
context "default" do
42+
let (:params) {{
43+
:owner => '',
44+
:group => ''
45+
}}
46+
it { is_expected.to contain_file("/requirements.txt").with(
47+
"owner" => "root",
48+
"group" => "root"
49+
)}
50+
end
51+
end
52+
end
53+
end
54+
end

0 commit comments

Comments
 (0)