2019-06-11 22:24:35 +00:00
|
|
|
require "helper"
|
|
|
|
require "inspec/resource"
|
|
|
|
require "inspec/resources/postgres_ident_conf"
|
|
|
|
require "inspec/resources/directory"
|
2017-07-03 18:01:40 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "Inspec::Resources::PGIdentConf" do
|
|
|
|
describe "PGIdentConf Paramaters" do
|
2021-07-01 09:58:58 +00:00
|
|
|
resource = load_resource("postgres_ident_conf", "C:/Program Files/PostgreSQL/9.5/main/pg_ident.conf")
|
2019-06-11 22:24:35 +00:00
|
|
|
it "Verify postgres_ident_conf filtering by `system_username`" do
|
|
|
|
entries = resource.where { system_username == "bryanh" }
|
|
|
|
_(entries.map_name).must_equal ["omicron"]
|
|
|
|
_(entries.pg_username).must_equal ["bryanh"]
|
2017-07-03 18:01:40 +00:00
|
|
|
end
|
2019-06-11 22:24:35 +00:00
|
|
|
it "Verify postgres_ident_conf filtering by `map_name`" do
|
|
|
|
entries = resource.where { map_name == "ssl-test" }
|
|
|
|
_(entries.system_username).must_equal ["ann"]
|
|
|
|
_(entries.pg_username).must_equal ["ann"]
|
2017-07-03 18:01:40 +00:00
|
|
|
end
|
2019-06-11 22:24:35 +00:00
|
|
|
it "Verify postgres_ident_conf filtering by `pg_username`" do
|
|
|
|
entries = resource.where { pg_username == "bob" }
|
|
|
|
_(entries.map_name).must_equal ["pki-users"]
|
|
|
|
_(entries.system_username).must_equal ["robert"]
|
2017-07-03 18:01:40 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|