summaryrefslogtreecommitdiff
path: root/worker/tests
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2012-11-13 14:56:52 +0000
committerSteve Kemp <steve@steve.org.uk>2012-11-13 14:56:52 +0000
commit88369e0204feda720b24af76d3b58955ca7b92cb (patch)
tree3a61d53fbf2e66d4b2731f429247d6cba0e9ac98 /worker/tests
parentd4b085c2d6ee67e421f9857f4c07560d52ba05d4 (diff)
Ensure we have a port + URL in the construcotr.
Diffstat (limited to 'worker/tests')
-rwxr-xr-xworker/tests/http.rb31
-rwxr-xr-xworker/tests/https.rb31
2 files changed, 38 insertions, 24 deletions
diff --git a/worker/tests/http.rb b/worker/tests/http.rb
index 5ad69cd..3796412 100755
--- a/worker/tests/http.rb
+++ b/worker/tests/http.rb
@@ -26,6 +26,25 @@ class HTTPTest
#
def initialize( data )
@test_data = data
+ @error = nil
+
+ #
+ # Ensure we have an URL
+ #
+ if ( @test_data["target_host"].nil? )
+ @error = "Missing URL for the test."
+ raise ArgumentError, @error
+ end
+
+ #
+ # Ensure we have a port
+ #
+ if ( @test_data["test_port"].nil? )
+ @error = "Missing port for the test."
+ raise ArgumentError, @error
+
+ end
+
end
@@ -40,18 +59,6 @@ class HTTPTest
#
def run_test
- @error = ""
-
-
- #
- # Ensure we had a URL
- #
- if ( @test_data["target_host"].nil? )
- @error = "Missing URL for the test"
- return false
- end
-
-
#
# Do the fetch, if this success then we'll have the
# @status + @text setup
diff --git a/worker/tests/https.rb b/worker/tests/https.rb
index fcc716b..55a423b 100755
--- a/worker/tests/https.rb
+++ b/worker/tests/https.rb
@@ -26,6 +26,25 @@ class HTTPSTest
#
def initialize( data )
@test_data = data
+ @error = nil
+
+ #
+ # Ensure we have an URL
+ #
+ if ( @test_data["target_host"].nil? )
+ @error = "Missing URL for the test."
+ raise ArgumentError, @error
+ end
+
+ #
+ # Ensure we have a port
+ #
+ if ( @test_data["test_port"].nil? )
+ @error = "Missing port for the test."
+ raise ArgumentError, @error
+
+ end
+
end
@@ -40,18 +59,6 @@ class HTTPSTest
#
def run_test
- @error = ""
-
-
- #
- # Ensure we had a URL
- #
- if ( @test_data["target_host"].nil? )
- @error = "Missing URL for the test"
- return false
- end
-
-
#
# Do the fetch, if this success then we'll have the
# @status + @text setup