source: other-projects/hathitrust/vagrant-hadoop-cluster/trunk/modules/stdlib/spec/acceptance/pw_hash_spec.rb@ 30903

Last change on this file since 30903 was 30903, checked in by davidb, 8 years ago

Vagrant provisioning files for a 4-node Hadoop cluster. See README.txt for more details

File size: 1.1 KB
Line 
1#! /usr/bin/env ruby -S rspec
2require 'spec_helper_acceptance'
3
4# Windows and OS X do not have useful implementations of crypt(3)
5describe 'pw_hash function', :unless => (UNSUPPORTED_PLATFORMS + ['windows', 'Darwin', 'SLES']).include?(fact('operatingsystem')) do
6 describe 'success' do
7 it 'hashes passwords' do
8 pp = <<-EOS
9 $o = pw_hash('password', 'sha-512', 'salt')
10 notice(inline_template('pw_hash is <%= @o.inspect %>'))
11 EOS
12
13 apply_manifest(pp, :catch_failures => true) do |r|
14 expect(r.stdout).to match(/pw_hash is "\$6\$salt\$IxDD3jeSOb5eB1CX5LBsqZFVkJdido3OUILO5Ifz5iwMuTS4XMS130MTSuDDl3aCI6WouIL9AjRbLCelDCy\.g\."/)
15 end
16 end
17
18 it 'returns nil if no password is provided' do
19 pp = <<-EOS
20 $o = pw_hash('', 'sha-512', 'salt')
21 notice(inline_template('pw_hash is <%= @o.inspect %>'))
22 EOS
23
24 apply_manifest(pp, :catch_failures => true) do |r|
25 expect(r.stdout).to match(/pw_hash is nil/)
26 end
27 end
28 end
29 describe 'failure' do
30 it 'handles less than three arguments'
31 it 'handles more than three arguments'
32 it 'handles non strings'
33 end
34end
Note: See TracBrowser for help on using the repository browser.