Skip to content

Commit 1a15f51

Browse files
committed
Adds spec to check facts are working
1 parent 691264f commit 1a15f51

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

spec/acceptance/facts_test_spec.rb

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
require 'spec_helper_acceptance'
2+
3+
describe 'python class' do
4+
5+
context 'facts' do
6+
install_python = <<-EOS
7+
class { 'python' :
8+
version => 'system',
9+
pip => true,
10+
virtualenv => true,
11+
}
12+
EOS
13+
14+
fact_notices = <<-EOS
15+
notify{"pip_version: ${::pip_version}":}
16+
notify{"system_python_version: ${::system_python_version}":}
17+
notify{"python_version: ${::python_version}":}
18+
notify{"virtualenv_version: ${::virtualenv_version}":}
19+
EOS
20+
21+
it 'should output python facts when not installed' do
22+
apply_manifest(fact_notices, :catch_failures => true) do |r|
23+
expect(r.stdout).to match(/python_version: \S+/)
24+
expect(r.stdout).to match(/pip_version: \S+/)
25+
expect(r.stdout).to match(/virtualenv_version: \S+/)
26+
expect(r.stdout).to match(/system_python_version: \S+/)
27+
end
28+
end
29+
30+
it 'sets up python' do
31+
apply_manifest(install_python, :catch_failures => true)
32+
end
33+
34+
it 'should output python facts when installed' do
35+
apply_manifest(fact_notices, :catch_failures => true) do |r|
36+
expect(r.stdout).to match(/python_version: \S+/)
37+
expect(r.stdout).to match(/pip_version: \S+/)
38+
expect(r.stdout).to match(/virtualenv_version: \S+/)
39+
expect(r.stdout).to match(/system_python_version: \S+/)
40+
end
41+
end
42+
end
43+
end

0 commit comments

Comments
 (0)