1 require 'spec_helper_acceptance'
3 # Windows and OS X do not have useful implementations of crypt(3)
4 describe 'pw_hash function', :unless => ['windows', 'Darwin', 'SLES'].include?(fact('operatingsystem')) do
7 $o = pw_hash('password', 'sha-512', 'salt')
8 notice(inline_template('pw_hash is <%= @o.inspect %>'))
10 it 'hashes passwords' do
11 apply_manifest(pp1, :catch_failures => true) do |r|
12 expect(r.stdout).to match(%r{pw_hash is "\$6\$salt\$IxDD3jeSOb5eB1CX5LBsqZFVkJdido3OUILO5Ifz5iwMuTS4XMS130MTSuDDl3aCI6WouIL9AjRbLCelDCy\.g\."})
17 $o = pw_hash('', 'sha-512', 'salt')
18 notice(inline_template('pw_hash is <%= @o.inspect %>'))
20 it 'returns nil if no password is provided' do
21 apply_manifest(pp2, :catch_failures => true) do |r|
22 expect(r.stdout).to match(%r{pw_hash is nil})
27 it 'handles less than three arguments'
28 it 'handles more than three arguments'
29 it 'handles non strings'