CFINSPEC-66 : Add unit test for unsupported os:ipfilter resource

Signed-off-by: Sonu Saha <sonu.saha@progress.com>
This commit is contained in:
Sonu Saha 2022-02-25 17:19:49 +05:30 committed by Clinton Wolfe
parent da875f7083
commit ccdfcd0445

View file

@ -6,9 +6,8 @@ describe "Inspec::Resources::Ipfilter" do
# freebsd11
it "verify ipfilter on freebsd11" do
resource = MockLoader.new(:freebsd11).load_resource("ipfilter")
_(resource.has_rule?("pass out quick on lo0 all")).must_equal true
_(resource.has_rule?("pass in quick on lo0 all")).must_equal true
_(resource.has_rule?("block in quick on dc0 inet from 10.0.0.0/8 to any")).must_equal true
_(resource.has_rule?("rule which does not exist")).must_equal false
_(resource.has_rule?(nil)).must_equal false
end
@ -16,17 +15,25 @@ describe "Inspec::Resources::Ipfilter" do
it "verify ipfilter on solaris11" do
resource = MockLoader.new(:solaris11).load_resource("ipfilter")
_(resource.has_rule?("pass out quick on lo0 all")).must_equal true
_(resource.has_rule?("pass in quick on lo0 all")).must_equal true
_(resource.has_rule?("block in quick on dc0 inet from 10.0.0.0/8 to any")).must_equal true
_(resource.has_rule?(nil)).must_equal false
_(resource.has_rule?("rule which does not exist")).must_equal false
end
# ubuntu
it "verify ipfilter on ubuntu" do
resource = MockLoader.new(:ubuntu).load_resource("ipfilter")
_(resource.has_rule?("pass out quick on lo0 all")).must_equal false
end
# windows
it "verify ipfilter on windows" do
resource = MockLoader.new(:windows).load_resource("ipfilter")
_(resource.has_rule?("pass out quick on lo0 all")).must_equal false
end
# undefined
it "verify ipfilter on unsupported os" do
resource = MockLoader.new(:undefined).load_resource("ipfilter")
_(resource.has_rule?("pass out quick on lo0 all")).must_equal false
_(resource.has_rule?("pass in quick on lo0 all")).must_equal false
_(resource.has_rule?("block in quick on dc0 inet from 10.0.0.0/8 to any")).must_equal false
end
end