forked from voxpupuli/puppet-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass_spec.rb
More file actions
45 lines (39 loc) · 1.21 KB
/
class_spec.rb
File metadata and controls
45 lines (39 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# frozen_string_literal: true
require 'spec_helper_acceptance'
describe 'python class' do
context 'default parameters' do
# Using puppet_apply as a helper
it 'works with no errors' do
pp = 'include python'
# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
end
context 'installing python 3' do
# Using puppet_apply as a helper
it 'works with no errors' do
pp = <<-EOS
class { 'python':
ensure => 'present',
pip => 'present',
dev => 'present',
venv => 'present',
}
EOS
# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
fact_notices = <<-EOS
notify{"pip_version: ${facts['pip3_version']}":}
notify{"python_version: ${facts['python3_version']}":}
EOS
it 'outputs python facts when not installed' do
apply_manifest(fact_notices, catch_failures: true) do |r|
expect(r.stdout).to match(%r{python_version: 3\.\S+})
expect(r.stdout).to match(%r{pip_version: \S+})
end
end
end
end