2015-09-15 12:38:19 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
|
|
|
|
describe 'file interface' do
|
|
|
|
let(:backend) { get_backend.call }
|
|
|
|
|
|
|
|
describe 'block device' do
|
2015-09-15 14:47:25 +00:00
|
|
|
let(:file) { backend.file('/tmp/block_device') }
|
2015-09-15 12:38:19 +00:00
|
|
|
|
|
|
|
it 'exists' do
|
|
|
|
file.exists?.must_equal(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'is a block device' do
|
|
|
|
file.block_device?.must_equal(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'has type :block_device' do
|
|
|
|
file.type.must_equal(:block_device)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'has no content' do
|
2015-09-15 14:52:46 +00:00
|
|
|
file.content.must_equal('')
|
2015-09-15 12:38:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'has owner name root' do
|
|
|
|
file.owner.must_equal('root')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'has group name' do
|
2015-09-15 14:47:25 +00:00
|
|
|
file.group.must_equal('root')
|
2015-09-15 12:38:19 +00:00
|
|
|
end
|
|
|
|
|
2015-09-15 14:47:25 +00:00
|
|
|
it 'has mode 0666' do
|
|
|
|
file.mode.must_equal(00666)
|
2015-09-15 12:38:19 +00:00
|
|
|
end
|
|
|
|
|
2015-09-15 14:47:25 +00:00
|
|
|
it 'checks mode? 0666' do
|
|
|
|
file.mode?(00666).must_equal(true)
|
2015-09-15 12:38:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'has no link_path' do
|
|
|
|
file.link_path.must_be_nil
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'has no md5sum' do
|
2015-09-15 14:52:46 +00:00
|
|
|
file.md5sum.must_equal('d41d8cd98f00b204e9800998ecf8427e')
|
2015-09-15 12:38:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'has no sha256sum' do
|
2015-09-15 14:52:46 +00:00
|
|
|
file.sha256sum.must_equal('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')
|
2015-09-15 12:38:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'has a modified time' do
|
2015-09-16 10:10:03 +00:00
|
|
|
file.mtime.must_be_close_to(Time.now.to_i - Test.mtime/2, Test.mtime)
|
2015-09-15 12:38:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'has inode size of 0' do
|
|
|
|
file.size.must_equal(0)
|
|
|
|
end
|
|
|
|
|
2015-09-16 06:27:35 +00:00
|
|
|
it 'has selinux label handling' do
|
2015-09-16 10:10:03 +00:00
|
|
|
file.selinux_label.must_equal(Test.selinux_label(os, file.path))
|
2015-09-15 12:38:19 +00:00
|
|
|
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
|