File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments