mirror of
https://github.com/inspec/inspec
synced 2024-11-10 07:04:15 +00:00
CFINSPEC-78: Add unit test for be_enabled and be_running
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
This commit is contained in:
parent
117c9230e9
commit
be4e6f7594
4 changed files with 19 additions and 0 deletions
1
test/fixtures/cmd/auditctl-s-enabled
vendored
Normal file
1
test/fixtures/cmd/auditctl-s-enabled
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
enabled 1
|
1
test/fixtures/cmd/auditctl-s-pid
vendored
Normal file
1
test/fixtures/cmd/auditctl-s-pid
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
pid 682462
|
|
@ -403,6 +403,10 @@ class MockLoader
|
|||
# mocks for be_immutable matcher for file resource
|
||||
"lsattr constantfile.txt" => cmd.call("lsattr-output"),
|
||||
%{sh -c 'type "lsattr"'} => empty.call,
|
||||
# linux_audit_system
|
||||
"/usr/sbin/auditctl -s | grep enabled" => cmd.call("auditctl-s-enabled"),
|
||||
"/usr/sbin/auditctl -s | grep pid" => cmd.call("auditctl-s-pid"),
|
||||
%{sh -c 'type "/usr/sbin/auditctl"'} => empty.call,
|
||||
# apache_conf
|
||||
"sh -c 'find /etc/apache2/ports.conf -type f -maxdepth 1'" => cmd.call("find-apache2-ports-conf"),
|
||||
"sh -c 'find /etc/httpd/conf.d/*.conf -type f -maxdepth 1'" => cmd.call("find-httpd-ssl-conf"),
|
||||
|
|
13
test/unit/resources/linux_audit_system_test.rb
Normal file
13
test/unit/resources/linux_audit_system_test.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
require "inspec/globals"
|
||||
require "#{Inspec.src_root}/test/helper"
|
||||
require_relative "../../../lib/inspec/resources/linux_audit_system"
|
||||
|
||||
describe Inspec::Resources::LinuxAuditSystem do
|
||||
|
||||
it "works correctly with the constructor on the platform" do
|
||||
resource = MockLoader.new(:ubuntu).load_resource("linux_audit_system")
|
||||
_(resource.enabled?).must_equal true
|
||||
_(resource.running?).must_equal true
|
||||
# _(resource.rules).must_include "some value"
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue