3 describe 'postgresql_acls_to_resources_hash', :type => :puppet_function do
4 context 'individual transform tests' do
6 input = 'local all postgres ident'
8 "postgresql class generated rule test 0"=>{
12 "auth_method"=>"ident",
17 should run.with_params([input], 'test', 100).and_return(result)
21 input = 'local all root ident'
23 "postgresql class generated rule test 0"=>{
27 "auth_method"=>"ident",
32 should run.with_params([input], 'test', 100).and_return(result)
37 'local all all ident',
40 "postgresql class generated rule test 0"=>{
44 "auth_method"=>"ident",
49 should run.with_params(input_array, 'test', 100).and_return(result)
53 input = 'host all all 127.0.0.1/32 md5'
55 "postgresql class generated rule test 0"=>{
59 "address"=>"127.0.0.1/32",
65 should run.with_params([input], 'test', 100).and_return(result)
69 input = 'host all all 0.0.0.0/0 md5'
71 "postgresql class generated rule test 0"=>{
75 "address"=>"0.0.0.0/0",
81 should run.with_params([input], 'test', 100).and_return(result)
85 input = 'host all all ::1/128 md5'
87 "postgresql class generated rule test 0"=>{
97 should run.with_params([input], 'test', 100).and_return(result)
101 input = 'host all all 1.1.1.1 255.255.255.0 md5'
103 "postgresql class generated rule test 0"=>{
107 "address"=>"1.1.1.1 255.255.255.0",
108 "auth_method"=>"md5",
113 should run.with_params([input], 'test', 100).and_return(result)
117 input = 'host all all 1.1.1.1 255.255.255.0 ldap ldapserver=ldap.example.net ldapprefix="cn=" ldapsuffix=", dc=example, dc=net"'
119 "postgresql class generated rule test 0"=>{
123 "address"=>"1.1.1.1 255.255.255.0",
124 "auth_method"=>"ldap",
125 "auth_option"=>"ldapserver=ldap.example.net ldapprefix=\"cn=\" ldapsuffix=\", dc=example, dc=net\"",
130 should run.with_params([input], 'test', 100).and_return(result)
134 it 'should return an empty hash when input is empty array' do
135 should run.with_params([], 'test', 100).and_return({})