2012-02-09 20:26:00 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2013-07-10 05:11:11 +02:00
|
|
|
describe 'the mysql_password function' do
|
2012-02-09 20:26:00 +01:00
|
|
|
before :all do
|
|
|
|
Puppet::Parser::Functions.autoloader.loadall
|
|
|
|
end
|
|
|
|
|
2013-08-18 02:55:00 +02:00
|
|
|
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
|
2012-02-09 20:26:00 +01:00
|
|
|
|
2013-07-10 05:11:11 +02:00
|
|
|
it 'should exist' do
|
|
|
|
Puppet::Parser::Functions.function('mysql_password').should == 'function_mysql_password'
|
2012-02-09 20:26:00 +01:00
|
|
|
end
|
|
|
|
|
2013-07-10 05:11:11 +02:00
|
|
|
it 'should raise a ParseError if there is less than 1 arguments' do
|
2013-08-18 02:55:00 +02:00
|
|
|
lambda { scope.function_mysql_password([]) }.should( raise_error(Puppet::ParseError))
|
2012-02-09 20:26:00 +01:00
|
|
|
end
|
|
|
|
|
2013-07-10 05:11:11 +02:00
|
|
|
it 'should raise a ParseError if there is more than 1 arguments' do
|
2013-08-18 02:55:00 +02:00
|
|
|
lambda { scope.function_mysql_password(%w(foo bar)) }.should( raise_error(Puppet::ParseError))
|
2012-02-09 20:26:00 +01:00
|
|
|
end
|
|
|
|
|
2013-07-10 05:11:11 +02:00
|
|
|
it 'should convert password into a hash' do
|
2013-08-18 02:55:00 +02:00
|
|
|
result = scope.function_mysql_password(%w(password))
|
2012-02-09 20:26:00 +01:00
|
|
|
result.should(eq('*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'))
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|