34 lines
1,023 B
Ruby
34 lines
1,023 B
Ruby
#!/usr/bin/env rspec
|
|
require 'spec_helper'
|
|
|
|
describe "the mysql_password function" do
|
|
before :all do
|
|
Puppet::Parser::Functions.autoloader.loadall
|
|
end
|
|
|
|
before :each do
|
|
@scope = if Puppet.version =~ /^3/
|
|
Puppet::Parser::Scope.new_for_test_harness('localhost')
|
|
else
|
|
Puppet::Parser::Scope.new
|
|
end
|
|
end
|
|
|
|
it "should exist" do
|
|
Puppet::Parser::Functions.function("mysql_password").should == "function_mysql_password"
|
|
end
|
|
|
|
it "should raise a ParseError if there is less than 1 arguments" do
|
|
lambda { @scope.function_mysql_password([]) }.should( raise_error(Puppet::ParseError))
|
|
end
|
|
|
|
it "should raise a ParseError if there is more than 1 arguments" do
|
|
lambda { @scope.function_mysql_password(['foo', 'bar']) }.should( raise_error(Puppet::ParseError))
|
|
end
|
|
|
|
it "should convert password into a hash" do
|
|
result = @scope.function_mysql_password(["password"])
|
|
result.should(eq('*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'))
|
|
end
|
|
|
|
end
|