mirror of
https://github.com/inspec/inspec
synced 2024-11-27 23:20:33 +00:00
682fe8f261
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
77 lines
1.5 KiB
Ruby
77 lines
1.5 KiB
Ruby
# encoding: utf-8
|
|
|
|
describe 'file interface' do
|
|
let(:backend) { get_backend.call }
|
|
|
|
describe 'a folder' do
|
|
let(:file) { backend.file('/tmp/folder') }
|
|
|
|
it 'exists' do
|
|
file.exists?.must_equal(true)
|
|
end
|
|
|
|
it 'is a directory' do
|
|
file.directory?.must_equal(true)
|
|
end
|
|
|
|
it 'has type :directory' do
|
|
file.type.must_equal(:directory)
|
|
end
|
|
|
|
it 'has no content' do
|
|
file.content.must_equal(nil)
|
|
end
|
|
|
|
it 'has owner name root' do
|
|
file.owner.must_equal('root')
|
|
end
|
|
|
|
it 'has group name root' do
|
|
file.group.must_equal('root')
|
|
end
|
|
|
|
it 'has mode 0567' do
|
|
file.mode.must_equal(00567)
|
|
end
|
|
|
|
it 'checks mode? 0567' do
|
|
file.mode?(00567).must_equal(true)
|
|
end
|
|
|
|
it 'has no link_path' do
|
|
file.link_path.must_be_nil
|
|
end
|
|
|
|
it 'has an md5sum' do
|
|
file.md5sum.must_equal(nil)
|
|
end
|
|
|
|
it 'has an sha256sum' do
|
|
file.sha256sum.must_equal(nil)
|
|
end
|
|
|
|
it 'has a modified time' do
|
|
file.mtime.must_be_close_to(Time.now.to_i - MTime/2, MTime)
|
|
end
|
|
|
|
it 'has inode size' do
|
|
file.size.must_be_close_to(4096, 4094)
|
|
end
|
|
|
|
it 'has selinux label handling' do
|
|
if os[:family] == 'redhat'
|
|
file.selinux_label.must_equal('unconfined_u:object_r:user_tmp_t:s0')
|
|
else
|
|
file.selinux_label.must_equal(nil)
|
|
end
|
|
end
|
|
|
|
it 'has no product_version' do
|
|
file.product_version.must_equal(nil)
|
|
end
|
|
|
|
it 'has no file_version' do
|
|
file.file_version.must_equal(nil)
|
|
end
|
|
end
|
|
end
|