2019-06-11 22:24:35 +00:00
|
|
|
require "helper"
|
|
|
|
require "inspec/resource"
|
|
|
|
require "inspec/resources/iis_site"
|
2018-11-08 18:42:59 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "Inspec::Resources::IisSite" do
|
|
|
|
it "verify Default Web Site settings" do
|
|
|
|
resource = MockLoader.new(:windows).load_resource("iis_site", "Default Web Site")
|
|
|
|
_(resource.send("app_pool")).must_equal "DefaultAppPool"
|
|
|
|
_(resource.send("bindings")).must_equal [
|
2018-11-08 18:42:59 +00:00
|
|
|
"http *:80:",
|
|
|
|
"net.tcp 808:*",
|
|
|
|
"net.pipe *",
|
|
|
|
"net.msmq localhost",
|
|
|
|
"msmq.formatname localhost",
|
2019-07-09 00:20:30 +00:00
|
|
|
"https *:443: sslFlags=0",
|
2018-11-08 18:42:59 +00:00
|
|
|
]
|
2019-06-11 22:24:35 +00:00
|
|
|
_(resource.send("state")).must_equal "Started"
|
|
|
|
_(resource.send("path")).must_equal '%SystemDrive%\\inetpub\\wwwroot'
|
|
|
|
_(resource.send("exists?")).must_equal true
|
|
|
|
_(resource.send("running?")).must_equal true
|
|
|
|
_(resource.send("has_app_pool?", "DefaultAppPool")).must_equal true
|
|
|
|
_(resource.send("has_app_pool?", "SomeOtherAppPool")).must_equal false
|
|
|
|
_(resource.send("has_path?", '%SystemDrive%\\inetpub\\wwwroot')).must_equal true
|
|
|
|
_(resource.send("has_path?", '%SystemDrive%\\inetpub\\wwwroot\\subpath')).must_equal false
|
|
|
|
_(resource.send("has_binding?", "https *:443: sslFlags=0")).must_equal true
|
|
|
|
_(resource.send("has_binding?", "https *:443:")).must_equal false
|
|
|
|
_(resource.send("has_binding?", "https :443:example.com sslFlags=0")).must_equal false
|
|
|
|
_(resource.send("to_s")).must_equal "iis_site 'Default Web Site'"
|
2022-06-02 11:21:14 +00:00
|
|
|
_(resource.send("resource_id")).must_equal "Default Web Site"
|
2018-11-08 18:42:59 +00:00
|
|
|
end
|
|
|
|
end
|