forked from theforeman/puppet-foreman
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforeman_plugin_openscap_spec.rb
More file actions
80 lines (68 loc) · 2.22 KB
/
foreman_plugin_openscap_spec.rb
File metadata and controls
80 lines (68 loc) · 2.22 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
require 'spec_helper'
describe 'foreman::plugin::openscap' 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
end
if facts[:osfamily] == 'RedHat'
context 'with configure_openscap_repo set to true' do
let :params do
{
:configure_openscap_repo => true
}
end
it 'should call the plugin' do
should contain_foreman__plugin('openscap')
end
it 'should install custom openscap repo' do
repo_base = facts[:operatingsystem] == 'Fedora' ? 'fedora' : 'epel'
should contain_yumrepo("isimluk-openscap").
with_baseurl("http://copr-be.cloud.fedoraproject.org/results/isimluk/OpenSCAP/#{repo_base}-#{facts[:operatingsystemmajrelease]}-$basearch/")
end
end
context 'with disabled repository installation' do
let :params do
{
:configure_openscap_repo => false
}
end
it 'should call the plugin' do
should contain_foreman__plugin('openscap')
end
it 'should not install custom openscap repo' do
should_not contain_yumrepo("isimluk-openscap")
end
end
else
context 'with disabled repository installation' do
let :params do
{
:configure_openscap_repo => false
}
end
it 'should call the plugin' do
should contain_foreman__plugin('openscap')
end
it 'should not install custom openscap repo' do
should_not contain_yumrepo("isimluk-openscap")
end
end
context 'with enabled repository installation' do
let :params do
{
:configure_openscap_repo => true
}
end
it 'should fail' do
expect {
should contain_foreman__plugin('openscap')
}.to raise_error(Puppet::Error, /Unsupported osfamily/)
end
end
end
end
end
end