From 94cffe6681e85ac399d0c2a24bf6987e00705834 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Thu, 15 Nov 2012 11:17:52 +0000 Subject: Resolve purely numeric alerts --- t/test-alerter.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 't/test-alerter.rb') 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 -- cgit v1.2.1