mirror of
https://github.com/inspec/inspec
synced 2025-02-17 06:28:40 +00:00
add integration test for user resource
This commit is contained in:
parent
c177a511fa
commit
191ef73c65
1 changed files with 44 additions and 0 deletions
44
test/integration/default/user_spec.rb
Normal file
44
test/integration/default/user_spec.rb
Normal file
|
@ -0,0 +1,44 @@
|
|||
# encoding: utf-8
|
||||
|
||||
# root test
|
||||
if ['centos', 'fedora', 'opensuse', 'debian', 'ubuntu'].include?(os[:family])
|
||||
|
||||
userinfo = {
|
||||
name: 'root',
|
||||
group: 'root',
|
||||
uid: 0,
|
||||
gid: 0,
|
||||
groups: ["root"],
|
||||
home: '/root',
|
||||
shell: '/bin/bash',
|
||||
}
|
||||
|
||||
# different groupset for centos 5
|
||||
userinfo[:groups] = ["root", "bin", "daemon", "sys", "adm", "disk", "wheel"] if os[:release].to_i == 5
|
||||
|
||||
elsif ['freebsd'].include?(os[:family])
|
||||
|
||||
userinfo = {
|
||||
name: 'root',
|
||||
group: 'wheel',
|
||||
uid: 0,
|
||||
gid: 0,
|
||||
groups: ["wheel", "operator"],
|
||||
home: '/root',
|
||||
shell: '/bin/csh',
|
||||
}
|
||||
|
||||
else
|
||||
userinfo = {}
|
||||
end
|
||||
|
||||
describe user(userinfo[:name]) do
|
||||
it { should exist }
|
||||
it { should belong_to_group userinfo[:group] }
|
||||
its('uid') { should eq userinfo[:uid] }
|
||||
its('gid') { should eq userinfo[:gid] }
|
||||
its('group') { should eq userinfo[:group] }
|
||||
its('groups') { should eq userinfo[:groups] }
|
||||
its('home') { should eq userinfo[:home] }
|
||||
its('shell') { should eq userinfo[:shell] }
|
||||
end
|
Loading…
Add table
Reference in a new issue