Suggest different variables to use if we want to tunnel both v4 and v6
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / acceptance / pw_hash_spec.rb
1 require 'spec_helper_acceptance'
2
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
5   describe 'success' do
6     pp1 = <<-DOC
7       $o = pw_hash('password', 'sha-512', 'salt')
8       notice(inline_template('pw_hash is <%= @o.inspect %>'))
9     DOC
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\."})
13       end
14     end
15
16     pp2 = <<-DOC
17       $o = pw_hash('', 'sha-512', 'salt')
18       notice(inline_template('pw_hash is <%= @o.inspect %>'))
19     DOC
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})
23       end
24     end
25   end
26   describe 'failure' do
27     it 'handles less than three arguments'
28     it 'handles more than three arguments'
29     it 'handles non strings'
30   end
31 end