forked from theforeman/puppet-foreman
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforeman_cli_spec.rb
More file actions
97 lines (82 loc) · 2.96 KB
/
foreman_cli_spec.rb
File metadata and controls
97 lines (82 loc) · 2.96 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
require 'spec_helper'
describe 'foreman::cli' do
on_supported_os.each do |os, facts|
next if only_test_os() and not only_test_os.include?(os)
next if exclude_test_os() and exclude_test_os.include?(os)
context "on #{os}" do
let(:facts) do
facts.merge({
:concat_basedir => '/tmp',
})
end
context 'standalone with parameters' do
let(:params) do {
'foreman_url' => 'http://example.com',
'username' => 'joe',
'password' => 'secret',
} end
it { should contain_package('foreman-cli').with_ensure('installed') }
describe '/etc/hammer/cli.modules.d/foreman.yml' do
it 'should contain settings' do
verify_exact_contents(catalogue, '/etc/hammer/cli.modules.d/foreman.yml', [
":foreman:",
" :enable_module: true",
" :host: 'http://example.com'",
])
end
end
describe '/root/.hammer/cli.modules.d/foreman.yml' do
it { should contain_file('/root/.hammer/cli.modules.d/foreman.yml').with_replace(false) }
it 'should contain settings' do
verify_exact_contents(catalogue, '/root/.hammer/cli.modules.d/foreman.yml', [
":foreman:",
" :username: 'joe'",
" :password: 'secret'",
" :refresh_cache: false",
" :request_timeout: 120",
])
end
end
describe 'with manage_root_config=false' do
let(:params) do {
'foreman_url' => 'http://example.com',
'username' => 'joe',
'password' => 'secret',
'manage_root_config' => false,
} end
it { should_not contain_file('/root/.hammer') }
it { should_not contain_file('/root/.hammer/cli.modules.d/foreman.yml') }
end
end
context 'with foreman' do
let :pre_condition do
"class { 'foreman':
admin_username => 'joe',
admin_password => 'secret',
}"
end
it { should contain_package('foreman-cli').with_ensure('installed') }
describe '/etc/hammer/cli.modules.d/foreman.yml' do
it 'should contain settings from foreman' do
verify_exact_contents(catalogue, '/etc/hammer/cli.modules.d/foreman.yml', [
":foreman:",
" :enable_module: true",
" :host: 'https://#{facts[:fqdn]}'",
])
end
end
describe '/root/.hammer/cli.modules.d/foreman.yml' do
it 'should contain settings from foreman' do
verify_exact_contents(catalogue, '/root/.hammer/cli.modules.d/foreman.yml', [
":foreman:",
" :username: 'joe'",
" :password: 'secret'",
" :refresh_cache: false",
" :request_timeout: 120",
])
end
end
end
end
end
end