diff options
| author | Steve Kemp <steve@steve.org.uk> | 2012-11-25 22:19:29 +0000 | 
|---|---|---|
| committer | Steve Kemp <steve@steve.org.uk> | 2012-11-25 22:19:29 +0000 | 
| commit | 8d59cc01d1b5f1dae91e5010bdb0493434d70a72 (patch) | |
| tree | 744a9b989ce986efd16f417046b3ad32be0fb114 /t | |
| parent | 01b04cb3bb81c50e3865ca3656e9c4ccc75f9f02 (diff) | |
  Parse the "otherwise 'xxxx'." part of the tests.
Diffstat (limited to 't')
| -rwxr-xr-x | t/test-custodian-parser.rb | 44 | 
1 files changed, 43 insertions, 1 deletions
| diff --git a/t/test-custodian-parser.rb b/t/test-custodian-parser.rb index 5017179..9b97262 100755 --- a/t/test-custodian-parser.rb +++ b/t/test-custodian-parser.rb @@ -230,7 +230,7 @@ EOF      #      in_txt  = "example.bytemark.co.uk must run smtp."      out_txt = parser.expand_macro( in_txt ) -     +      #      #  The difference is the return value will be an array      # @@ -260,4 +260,46 @@ EOF      assert( ret[1] =~ /example2/)    end + + + +  # +  # Test that the text we're going to use in alerters is present. +  # +  def test_alert_text + +    # +    # test data +    # +    data = { +      "foo must run rsync."                     => nil, +      "foo must not run ping."                  => nil, +      "foo must not run ssh otherwise 'fail'"   => "fail", +      "foo must not run ssh otherwise 'fail'."  => "fail", +      "foo must run ldap otherwise 'ldap dead?'" => "ldap dead?", +      "foo must run ping otherwise 'don't you love me?'" => "don" +    } + +    # +    #  For each test +    # +    data.each do |str,fail| +      assert_nothing_raised do + +        # +        # Create the new parser +        # +        obj = Custodian::TestFactory.create( str ) + +        assert(obj) + +        if ( fail.nil? ) +          assert( obj.get_notification_text().nil? ) +        else +          assert_equal( obj.get_notification_text(), fail ) +        end + +      end +    end +  end  end | 
