Skip to content

Commit

Permalink
(spec) improve admin user account tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoblitt committed Oct 20, 2023
1 parent 328f33e commit d570d31
Showing 1 changed file with 31 additions and 16 deletions.
47 changes: 31 additions & 16 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -363,26 +363,41 @@ def node_files
end
end

it do
is_expected.to contain_user('csilva_b').with(
ensure: 'present',
groups: ['wheel_b'],
purge_ssh_keys: true,
)
admin_users = %w[
jhoblitt_b
cbarria_b
csilva_b
]

(admin_users + ['root']).each do |user|
it do
is_expected.to contain_ssh__server__match_block(user).with(
type: 'user',
options: {
'AuthorizedKeysFile' => '.ssh/authorized_keys',
},
)
end
end

it do
is_expected.to contain_user('hreinking_b').with(
ensure: 'absent',
)
admin_users.each do |user|
it do
is_expected.to contain_user(user).with(
ensure: 'present',
groups: ['wheel_b'],
purge_ssh_keys: true,
)
end
end

it do
is_expected.to contain_file('/home/hreinking_b').with(
ensure: 'absent',
recurse: true,
force: true,
)
%w[
lssttech
sysadmin
athebo
athebo_b
hreinking_b
].each do |user|
it { is_expected.to contain_user(user).with_ensure('absent') }
end

it { is_expected.to contain_class('systemd').with_manage_udevd(true) }
Expand Down

0 comments on commit d570d31

Please sign in to comment.