diff options
author | Steve Kemp <steve@steve.org.uk> | 2015-04-16 16:14:06 +0100 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2015-04-16 16:14:06 +0100 |
commit | c31a047c7ecf949b3cf8369985946f563957bf0a (patch) | |
tree | daa4a5bc7db319540d31c873a32f7c58b411f8b3 /lib/custodian/protocoltest/http.rb | |
parent | 3d15acf163a514816f3d2e2d08730dfb708fe5fd (diff) |
Updated test-handler for new API.
This update consists of two changes:
* No longer return "true" or "false" instead return "TEST_FAILED", or "TEST_SUCCEEDED".
* Removed the testing of test-inversion from the class, now it lives in the base-class where it should have done all along.
Diffstat (limited to 'lib/custodian/protocoltest/http.rb')
-rw-r--r-- | lib/custodian/protocoltest/http.rb | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/lib/custodian/protocoltest/http.rb b/lib/custodian/protocoltest/http.rb index 9ce1980..997f2f9 100644 --- a/lib/custodian/protocoltest/http.rb +++ b/lib/custodian/protocoltest/http.rb @@ -1,5 +1,7 @@ require 'custodian/settings' +require 'custodian/testfactory' + require 'timeout' require 'uri' @@ -97,15 +99,6 @@ module Custodian # - # Is this test inverted? - # - if line =~ /must\s+not\s+run\s+/ - @inverted = true - else - @inverted = false - end - - # # Expected status # if line =~ /with status ([0-9]+)/ @@ -203,7 +196,7 @@ module Custodian require 'curb' rescue LoadError @error = "The required rubygem 'curb' was not found." - return false + return Custodian::TestResult::TEST_FAILED end # @@ -309,8 +302,8 @@ module Custodian end if content.is_a?(String) and - expected_content.is_a?(String) and - content !~ /#{expected_content}/i + expected_content.is_a?(String) and + content !~ /#{expected_content}/i errors << "#{protocol_msg}: The response did not contain our expected text '#{expected_content}'." end end @@ -325,13 +318,13 @@ module Custodian errors << "Host header was overridden as Host: #{@host_override}" end @error = errors.join("\n") - return false + return Custodian::TestResult::TEST_FAILED end # # All done. # - true + Custodian::TestResult::TEST_PASSED end # |