summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2014-12-11 12:43:47 +0000
committerPatrick J Cherry <patrick@bytemark.co.uk>2014-12-11 12:43:47 +0000
commit2adfccca3ac97bedeaec092ba621db17ac0cf004 (patch)
treeb6636134101c74c2006624745c4679ca9f17f566 /t
parent84dd6a2c9078a70424f5b7a771f2c49b5d478ace (diff)
Moved test-dns-types so that it gets included in the test suite.
Added test for run_test.
Diffstat (limited to 't')
-rwxr-xr-xt/test-dns-types.rb (renamed from t/test-dns-types)22
1 files changed, 21 insertions, 1 deletions
diff --git a/t/test-dns-types b/t/test-dns-types.rb
index dba7a3c..3f122e4 100755
--- a/t/test-dns-types
+++ b/t/test-dns-types.rb
@@ -2,7 +2,7 @@
require 'test/unit'
-
+require 'mocha/test_unit'
require 'custodian/protocoltests'
@@ -56,6 +56,26 @@ class TestDNSTypes < Test::Unit::TestCase
end
end
+ #
+ # Now test the protocol stuff, without doing the resolution itself.
+ #
+ def test_dns_protocol_test
+ test = Custodian::TestFactory.create( "a.ns.bytemark.co.uk must run dns for bytemark.co.uk resolving A as '1.2.3.4,2001:lower::case,2001:UPPER::CASE'." )
+ test.stubs(:resolve_via).returns(%w(2001:lower::case 2001:upper::case 1.2.3.4))
+ assert test.run_test, test.error
+
+ # Re-stub to return just one record
+ test.stubs(:resolve_via).returns(%w(1.2.3.4))
+ assert !test.run_test
+
+ # Re-stub to return too many records
+ test.stubs(:resolve_via).returns(%w(2001:lower::case 2001:upper::case 1.2.3.4 1.2.3.5))
+ assert !test.run_test
+
+ # Re-stub to return no records
+ test.stubs(:resolve_via).returns([])
+ assert !test.run_test
+ end
end