summaryrefslogtreecommitdiff
path: root/t/test-custodian-parser.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2013-04-23 10:23:17 +0100
committerSteve Kemp <steve@steve.org.uk>2013-04-23 10:23:17 +0100
commit5ca0eb3ce526fda368dc4b35e795cfc7b7658c80 (patch)
treec012602d0af8354efbdaff5a3f74dfd9cd00f94f /t/test-custodian-parser.rb
parent521970d92aa9341de76eff1086bca1bea0675665 (diff)
Updated the parser to allow the test to specify whether HTTP-redirects
are followed. Added test-cases to match.
Diffstat (limited to 't/test-custodian-parser.rb')
-rwxr-xr-xt/test-custodian-parser.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/t/test-custodian-parser.rb b/t/test-custodian-parser.rb
index 811cbb5..f982b10 100755
--- a/t/test-custodian-parser.rb
+++ b/t/test-custodian-parser.rb
@@ -275,6 +275,43 @@ EOF
end
+ #
+ # Test that the parser works for HTTP-redirection
+ #
+ def test_http_redirection
+
+ #
+ # test data
+ #
+ data = {
+ "http://example must run http." => true,
+ "http://example must run http with status 200." => true,
+ "http://example must run http with content 'bar'." => true,
+ "http://example must run http following redirects." => true,
+ "http://example must run http not following redirects." => false,
+ "http://example must run http not following redirect." => false,
+ }
+
+ data.each do |str,follow|
+ assert_nothing_raised do
+
+ #
+ # Create the new parser
+ #
+ obj = Custodian::TestFactory.create( str )
+
+ assert(obj)
+
+ if ( follow )
+ assert( obj.follow_redirects? )
+ else
+ assert( ! obj.follow_redirects? )
+ end
+ end
+ end
+ end
+
+
#
# Test that the text we're going to use in alerters is present.