diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2014-12-11 12:43:47 +0000 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2014-12-11 12:43:47 +0000 |
commit | 41adca1d2b456735dcfdcf6d8d15b3cbda74983a (patch) | |
tree | 0af5509bafc069b1acfa2d85541c75787992f3a7 | |
parent | eebda5a0e4962ab27aa1fe73f7c369c30015969f (diff) |
Moved test-dns-types so that it gets included in the test suite.
Added test for run_test.
--HG--
rename : t/test-dns-types => t/test-dns-types.rb
-rwxr-xr-x | t/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 |