forked from redhat-openstack/openstack-puppet-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
733 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'pick_default function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do | ||
describe 'success' do | ||
it 'pick_defaults a default value' do | ||
pp = <<-EOS | ||
$a = undef | ||
$o = pick_default($a, 'default') | ||
notice(inline_template('picked is <%= @o.inspect %>')) | ||
EOS | ||
|
||
apply_manifest(pp, :catch_failures => true) do |r| | ||
expect(r.stdout).to match(/picked is "default"/) | ||
end | ||
end | ||
it 'pick_defaults with no value' do | ||
pp = <<-EOS | ||
$a = undef | ||
$b = undef | ||
$o = pick_default($a,$b) | ||
notice(inline_template('picked is <%= @o.inspect %>')) | ||
EOS | ||
|
||
apply_manifest(pp, :catch_failures => true) do |r| | ||
expect(r.stdout).to match(/picked is ""/) | ||
end | ||
end | ||
it 'pick_defaults the first set value' do | ||
pp = <<-EOS | ||
$a = "something" | ||
$b = "long" | ||
$o = pick_default($a, $b, 'default') | ||
notice(inline_template('picked is <%= @o.inspect %>')) | ||
EOS | ||
|
||
apply_manifest(pp, :catch_failures => true) do |r| | ||
expect(r.stdout).to match(/picked is "something"/) | ||
end | ||
end | ||
end | ||
describe 'failure' do | ||
it 'raises error with no values' do | ||
pp = <<-EOS | ||
$o = pick_default() | ||
notice(inline_template('picked is <%= @o.inspect %>')) | ||
EOS | ||
|
||
apply_manifest(pp, :expect_failures => true) do |r| | ||
expect(r.stderr).to match(/Must receive at least one argument/) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'range function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do | ||
describe 'success' do | ||
it 'ranges letters' do | ||
pp = <<-EOS | ||
$o = range('a','d') | ||
notice(inline_template('range is <%= @o.inspect %>')) | ||
EOS | ||
|
||
apply_manifest(pp, :catch_failures => true) do |r| | ||
expect(r.stdout).to match(/range is \["a", "b", "c", "d"\]/) | ||
end | ||
end | ||
it 'ranges letters with a step' do | ||
pp = <<-EOS | ||
$o = range('a','d', '2') | ||
notice(inline_template('range is <%= @o.inspect %>')) | ||
EOS | ||
|
||
apply_manifest(pp, :catch_failures => true) do |r| | ||
expect(r.stdout).to match(/range is \["a", "c"\]/) | ||
end | ||
end | ||
it 'ranges letters with a negative step' | ||
it 'ranges numbers' | ||
it 'ranges numbers with a step' | ||
it 'ranges numbers with a negative step' | ||
it 'ranges numeric strings' | ||
it 'ranges zero padded numbers' | ||
end | ||
describe 'failure' do | ||
it 'fails with no arguments' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'reverse function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do | ||
describe 'success' do | ||
it 'reverses strings' do | ||
pp = <<-EOS | ||
$a = "the public art galleries" | ||
# Anagram: Large picture halls, I bet | ||
$o = reverse($a) | ||
notice(inline_template('reverse is <%= @o.inspect %>')) | ||
EOS | ||
|
||
apply_manifest(pp, :catch_failures => true) do |r| | ||
expect(r.stdout).to match(/reverse is "seirellag tra cilbup eht"/) | ||
end | ||
end | ||
end | ||
describe 'failure' do | ||
it 'handles no arguments' | ||
it 'handles non strings or arrays' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'rstrip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do | ||
describe 'success' do | ||
it 'rstrips arrays' do | ||
pp = <<-EOS | ||
$a = [" the "," public "," art","galleries "] | ||
# Anagram: Large picture halls, I bet | ||
$o = rstrip($a) | ||
notice(inline_template('rstrip is <%= @o.inspect %>')) | ||
EOS | ||
|
||
apply_manifest(pp, :catch_failures => true) do |r| | ||
expect(r.stdout).to match(/rstrip is \[" the", " public", " art", "galleries"\]/) | ||
end | ||
end | ||
it 'rstrips strings' do | ||
pp = <<-EOS | ||
$a = " blowzy night-frumps vex'd jack q " | ||
$o = rstrip($a) | ||
notice(inline_template('rstrip is <%= @o.inspect %>')) | ||
EOS | ||
|
||
apply_manifest(pp, :catch_failures => true) do |r| | ||
expect(r.stdout).to match(/rstrip is " blowzy night-frumps vex'd jack q"/) | ||
end | ||
end | ||
end | ||
describe 'failure' do | ||
it 'handles no arguments' | ||
it 'handles non strings or arrays' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'shuffle function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do | ||
describe 'success' do | ||
it 'shuffles arrays' do | ||
pp = <<-EOS | ||
$a = ["the","public","art","galleries"] | ||
# Anagram: Large picture halls, I bet | ||
$o = shuffle($a) | ||
notice(inline_template('shuffle is <%= @o.inspect %>')) | ||
EOS | ||
|
||
apply_manifest(pp, :catch_failures => true) do |r| | ||
expect(r.stdout).to_not match(/shuffle is \["the", "public", "art", "galleries"\]/) | ||
end | ||
end | ||
it 'shuffles strings' do | ||
pp = <<-EOS | ||
$a = "blowzy night-frumps vex'd jack q" | ||
$o = shuffle($a) | ||
notice(inline_template('shuffle is <%= @o.inspect %>')) | ||
EOS | ||
|
||
apply_manifest(pp, :catch_failures => true) do |r| | ||
expect(r.stdout).to_not match(/shuffle is "blowzy night-frumps vex'd jack q"/) | ||
end | ||
end | ||
end | ||
describe 'failure' do | ||
it 'handles no arguments' | ||
it 'handles non strings or arrays' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'squeeze function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do | ||
describe 'success' do | ||
it 'squeezes arrays' do | ||
pp = <<-EOS | ||
# Real words! | ||
$a = ["wallless", "laparohysterosalpingooophorectomy", "brrr", "goddessship"] | ||
$o = squeeze($a) | ||
notice(inline_template('squeeze is <%= @o.inspect %>')) | ||
EOS | ||
|
||
apply_manifest(pp, :catch_failures => true) do |r| | ||
expect(r.stdout).to match(/squeeze is \["wales", "laparohysterosalpingophorectomy", "br", "godeship"\]/) | ||
end | ||
end | ||
it 'squeezez arrays with an argument' | ||
it 'squeezes strings' do | ||
pp = <<-EOS | ||
$a = "wallless laparohysterosalpingooophorectomy brrr goddessship" | ||
$o = squeeze($a) | ||
notice(inline_template('squeeze is <%= @o.inspect %>')) | ||
EOS | ||
|
||
apply_manifest(pp, :catch_failures => true) do |r| | ||
expect(r.stdout).to match(/squeeze is "wales laparohysterosalpingophorectomy br godeship"/) | ||
end | ||
end | ||
|
||
it 'squeezes strings with an argument' do | ||
pp = <<-EOS | ||
$a = "countessship duchessship governessship hostessship" | ||
$o = squeeze($a, 's') | ||
notice(inline_template('squeeze is <%= @o.inspect %>')) | ||
EOS | ||
|
||
apply_manifest(pp, :catch_failures => true) do |r| | ||
expect(r.stdout).to match(/squeeze is "counteship ducheship governeship hosteship"/) | ||
end | ||
end | ||
end | ||
describe 'failure' do | ||
it 'handles no arguments' | ||
it 'handles non strings or arrays' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'str2bool function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do | ||
describe 'success' do | ||
it 'works with "y"' do | ||
pp = <<-EOS | ||
$o = str2bool('y') | ||
notice(inline_template('str2bool is <%= @o.inspect %>')) | ||
EOS | ||
|
||
apply_manifest(pp, :catch_failures => true) do |r| | ||
expect(r.stdout).to match(/str2bool is true/) | ||
end | ||
end | ||
it 'works with "Y"' | ||
it 'works with "yes"' | ||
it 'works with "1"' | ||
it 'works with "true"' | ||
it 'works with "n"' | ||
it 'works with "N"' | ||
it 'works with "no"' | ||
it 'works with "0"' | ||
it 'works with "false"' | ||
it 'works with undef' | ||
end | ||
describe 'failure' do | ||
it 'handles no arguments' | ||
it 'handles non arrays or strings' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'str2saltedsha512 function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do | ||
describe 'success' do | ||
it 'works with "y"' do | ||
pp = <<-EOS | ||
$o = str2saltedsha512('password') | ||
notice(inline_template('str2saltedsha512 is <%= @o.inspect %>')) | ||
EOS | ||
|
||
apply_manifest(pp, :catch_failures => true) do |r| | ||
expect(r.stdout).to match(/str2saltedsha512 is "[a-f0-9]{136}"/) | ||
end | ||
end | ||
end | ||
describe 'failure' do | ||
it 'handles no arguments' | ||
it 'handles more than one argument' | ||
it 'handles non strings' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'strftime function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do | ||
describe 'success' do | ||
it 'gives the Century' do | ||
pp = <<-EOS | ||
$o = strftime('%C') | ||
notice(inline_template('strftime is <%= @o.inspect %>')) | ||
EOS | ||
|
||
apply_manifest(pp, :catch_failures => true) do |r| | ||
expect(r.stdout).to match(/strftime is "20"/) | ||
end | ||
end | ||
it 'takes a timezone argument' | ||
end | ||
describe 'failure' do | ||
it 'handles no arguments' | ||
it 'handles invalid format strings' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'strip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do | ||
describe 'success' do | ||
it 'strips arrays' do | ||
pp = <<-EOS | ||
$a = [" the "," public "," art","galleries "] | ||
# Anagram: Large picture halls, I bet | ||
$o = strip($a) | ||
notice(inline_template('strip is <%= @o.inspect %>')) | ||
EOS | ||
|
||
apply_manifest(pp, :catch_failures => true) do |r| | ||
expect(r.stdout).to match(/strip is \["the", "public", "art", "galleries"\]/) | ||
end | ||
end | ||
it 'strips strings' do | ||
pp = <<-EOS | ||
$a = " blowzy night-frumps vex'd jack q " | ||
$o = strip($a) | ||
notice(inline_template('strip is <%= @o.inspect %>')) | ||
EOS | ||
|
||
apply_manifest(pp, :catch_failures => true) do |r| | ||
expect(r.stdout).to match(/strip is "blowzy night-frumps vex'd jack q"/) | ||
end | ||
end | ||
end | ||
describe 'failure' do | ||
it 'handles no arguments' | ||
it 'handles non strings or arrays' | ||
end | ||
end |
Oops, something went wrong.