Revision 5534df90
Added by Dominic Cleal almost 10 years ago
spec/classes/foreman_cli_spec.rb | ||
---|---|---|
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') }
|
||
... | ... | |
content = subject.resource('file', '/root/.hammer/cli.modules.d/foreman.yml').send(:parameters)[:content]
|
||
content.split("\n").reject { |c| c =~ /(^\s*#|^$)/ }.should == [
|
||
":foreman:",
|
||
" :username: 'admin'",
|
||
" :password: 'changeme'",
|
||
" :username: 'joe'",
|
||
" :password: 'secret'",
|
||
" :refresh_cache: false",
|
||
" :request_timeout: 120",
|
||
]
|
||
... | ... | |
describe 'with manage_root_config=false' do
|
||
let(:params) do {
|
||
'foreman_url' => 'http://example.com',
|
||
'username' => 'joe',
|
||
'password' => 'secret',
|
||
'manage_root_config' => false,
|
||
} end
|
||
|
||
... | ... | |
} end
|
||
|
||
let :pre_condition do
|
||
"class { 'foreman': }"
|
||
"class { 'foreman':
|
||
admin_username => 'joe',
|
||
admin_password => 'secret',
|
||
}"
|
||
end
|
||
|
||
it { should contain_package('foreman-cli').with_ensure('installed') }
|
||
... | ... | |
]
|
||
end
|
||
end
|
||
|
||
describe '/root/.hammer/cli.modules.d/foreman.yml' do
|
||
it 'should contain settings from foreman' do
|
||
content = subject.resource('file', '/root/.hammer/cli.modules.d/foreman.yml').send(:parameters)[:content]
|
||
content.split("\n").reject { |c| c =~ /(^\s*#|^$)/ }.should == [
|
||
":foreman:",
|
||
" :username: 'joe'",
|
||
" :password: 'secret'",
|
||
" :refresh_cache: false",
|
||
" :request_timeout: 120",
|
||
]
|
||
end
|
||
end
|
||
end
|
||
end
|
Also available in: Unified diff
refs #3272 - pass admin user details into db:seed rake task