summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2012-12-10 13:17:01 +0000
committerSteve Kemp <steve@steve.org.uk>2012-12-10 13:17:01 +0000
commit97b2d9a17e83d0d69eddcc80c2d141dbccba24ce (patch)
tree2c8e8d2c0f654b5ccbed5a4a82c26c53e32f39a3 /t
parent46097bf25ca174c974742f4e9e0196bb819c5da1 (diff)
Ensure we raise an exception if we're trying to resolve an unknown record-type.
Added test-case too.
Diffstat (limited to 't')
-rwxr-xr-xt/test-dns-types61
1 files changed, 61 insertions, 0 deletions
diff --git a/t/test-dns-types b/t/test-dns-types
new file mode 100755
index 0000000..dba7a3c
--- /dev/null
+++ b/t/test-dns-types
@@ -0,0 +1,61 @@
+#!/usr/bin/ruby -Ilib/ -I../lib/
+
+
+require 'test/unit'
+
+require 'custodian/protocoltests'
+
+
+
+#
+# The DNS test is a complex one.
+#
+class TestDNSTypes < Test::Unit::TestCase
+
+ #
+ # Create the test suite environment: NOP.
+ #
+ def setup
+ end
+
+ #
+ # Destroy the test suite environment: NOP.
+ #
+ def teardown
+ end
+
+
+ #
+ # Test the known-record types: A, NS, MX, AAAA
+ #
+ def test_known_types
+
+ assert_nothing_raised do
+ test = Custodian::TestFactory.create( "a.ns.bytemark.co.uk must run dns for bytemark.co.uk resolving NS as 'foo'." )
+ test = Custodian::TestFactory.create( "a.ns.bytemark.co.uk must run dns for bytemark.co.uk resolving A as 'foo'." )
+ test = Custodian::TestFactory.create( "a.ns.bytemark.co.uk must run dns for bytemark.co.uk resolving MX as 'foo'." )
+ test = Custodian::TestFactory.create( "a.ns.bytemark.co.uk must run dns for bytemark.co.uk resolving AAAA as 'foo'." )
+ end
+
+ end
+
+
+
+ #
+ # Test that using random types fails.
+ #
+ def test_unknown_types
+
+ #
+ # Each of these will fail
+ #
+ %w( a ns www example fdskfjdlfsj `` ).each do |res|
+ assert_raise ArgumentError do
+ Custodian::TestFactory.create( "a.ns.bytemark.co.uk must run dns for bytemark.co.uk resolving #{res} as 'foo'." )
+ end
+ end
+ end
+
+
+end
+