inspec/test/unit/resources/postgres_ident_conf_test.rb

27 lines
980 B
Ruby
Raw Normal View History

New postgres_ident_conf resource (#1963) * Initial commit of pg_ident_conf resource Signed-off-by: Rony Xavier <rx294@nyu.edu> * Initial commit of pg_ident_conf resource Signed-off-by: Rony Xavier <rx294@nyu.edu> * Small updates to organization of code Signed-off-by: Aaron Lippold <lippold@gmail.com> Signed-off-by: Rony Xaiver <rx294@nyu.edu> * updated `conf_path` instance var to `conf_file` since we are returning a file. Signed-off-by: Aaron Lippold <lippold@gmail.com> * Updated few bugs on pg_ident_conf added test files and docs Signed-off-by: Rony Xavier <rx294@nyu.edu> * Updated docs Signed-off-by: Rony Xavier <rx294@nyu.edu> * Added mock folders Signed-off-by: Rony Xavier <rx294@nyu.edu> * Added mock folders Signed-off-by: Rony Xavier <rx294@nyu.edu> Signed-off-by: Aaron Lippold <lippold@gmail.com> * Added mock folders Signed-off-by: Rony Xavier <rx294@nyu.edu> Signed-off-by: Aaron Lippold <lippold@gmail.com> * Added OS check Signed-off-by: Rony Xavier <rx294@nyu.edu> * Added mock file Signed-off-by: Rony Xavier <rx294@nyu.edu> * Added mock folders Signed-off-by: Rony Xavier <rx294@nyu.edu> Signed-off-by: Aaron Lippold <lippold@gmail.com> * added windows mock file Signed-off-by: Aaron Lippold <lippold@gmail.com> * Changed resource name from pg_ident_conf to postgres_ident_conf Signed-off-by: Rony Xavier <rx294@nyu.edu> * Completed corrections reccomended on PR Signed-off-by: Rony Xavier <rx294@nyu.edu> * removed copyright information Signed-off-by: Aaron Lippold <lippold@gmail.com>
2017-07-03 18:01:40 +00:00
# author: Aaron Lippold, lippold@gmail.com
# author: Rony Xavier, rx294@nyu.edu
require 'helper'
require 'inspec/resource'
describe 'Inspec::Resources::PGIdentConf' do
describe 'PGIdentConf Paramaters' do
resource = load_resource('postgres_ident_conf')
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']
end
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']
end
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']
end
end
end