diff options
Diffstat (limited to 'worker/tests/http.rb')
-rwxr-xr-x | worker/tests/http.rb | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/worker/tests/http.rb b/worker/tests/http.rb index 4f2cf0b..eaa351f 100755 --- a/worker/tests/http.rb +++ b/worker/tests/http.rb @@ -46,7 +46,7 @@ class HTTPTest # # Ensure we had a URL # - if ( @test_data[:target_host].nil? ) + if ( @test_data["target_host"].nil? ) @error = "Missing URL for the test" return false end @@ -56,27 +56,27 @@ class HTTPTest # Do the fetch, if this success then we'll have the # @status + @text setup # - if ( getURL (@test_data[:target_host] ) ) + if ( getURL (@test_data["target_host"] ) ) # # Do we need to test for a HTTP status code? # - if ( @test_data[:http_status] ) - puts "Testing for HTTP status code: #{@test_data[:http_status]}" + if ( @test_data["http_status"] ) + puts "Testing for HTTP status code: #{@test_data['http_status']}" - if ( @status != @test_data[:http_status].to_i) - @error = "#{@error} status code was #{@status} not #{@test_data[:http_status]}" + if ( @status != @test_data['http_status'].to_i) + @error = "#{@error} status code was #{@status} not #{@test_data['http_status']}" end end # # Do we need to search for text in the body of the reply? # - if ( @test_data[:http_text] ) - puts "Testing for text in the response: #{@test_data[:http_text]}" + if ( @test_data['http_text'] ) + puts "Testing for text in the response: #{@test_data['http_text']}" - if (! @body.match(/#{@test_data[:http_text]}/i) ) - @error = "#{@error} The respond did not contain #{test_data[:http_text]}" + if (! @body.match(/#{@test_data['http_text']}/i) ) + @error = "#{@error} The respond did not contain #{test_data['http_text']}" end end @@ -154,12 +154,12 @@ if __FILE__ == $0 then # Sample data. # test = { - :target_host => "http://www.steve.org.uk/", - :test_type => "http", - :test_port => 80, - :test_alert => "Steve's website is unavailable", - :http_text => "Steve Kemp", - :http_status => "200" + "target_host" => "http://www.steve.org.uk/", + "test_type" => "http", + "test_port" => 80, + "test_alert" => "Steve's website is unavailable", + "http_text" => "Steve Kemp", + "http_status" => "200" } |