summaryrefslogtreecommitdiff
path: root/t/test-alerter.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2012-11-15 11:17:52 +0000
committerSteve Kemp <steve@steve.org.uk>2012-11-15 11:17:52 +0000
commit8a24619f05de1f52a65fdd36e7a8a6643a887953 (patch)
tree4615836f4f61ac44e3071d807a6f39c4e04b98a9 /t/test-alerter.rb
parent2068bd814c9627a865a87085bbbaba044cf989d6 (diff)
Resolve purely numeric alerts
Diffstat (limited to 't/test-alerter.rb')
-rwxr-xr-xt/test-alerter.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/t/test-alerter.rb b/t/test-alerter.rb
index 88dc786..97e19b5 100755
--- a/t/test-alerter.rb
+++ b/t/test-alerter.rb
@@ -92,6 +92,33 @@ class TestAlerter < Test::Unit::TestCase
+ #
+ # Test documentation-detection.
+ #
+ def test_locations_inside_outside
+
+ obj = Alerter.new( nil )
+
+ assert_raise ArgumentError do
+ obj.document_address( nil )
+ end
+
+ #
+ # IPv6 lookup
+ #
+ details = obj.document_address( "2001:41c8:125:46::22" )
+ assert( details =~ /ssh.steve.org.uk/i )
+ #
+ # IPv4 lookup
+ #
+ details = obj.document_address( "80.68.85.48" )
+ assert( details =~ /ssh.steve.org.uk/i )
+ #
+ # Bogus lookup - should return nil.
+ #
+ details = obj.document_address( "800.683.853.348" )
+ assert( details.nil? )
+ end
end