diff options
author | Kai Blin <kai@samba.org> | 2011-12-16 11:36:47 +0100 |
---|---|---|
committer | Kai Blin <kai@samba.org> | 2011-12-17 02:46:08 +0100 |
commit | 589d995276f4868a1801d5d41f9a527a6323dbb9 (patch) | |
tree | 71e6bb84c4e84ab25d107bec509cd31d1f132187 /source4 | |
parent | 8b82bad0065895e0417f095c6b9ed2ada31fbdaa (diff) | |
download | samba-589d995276f4868a1801d5d41f9a527a6323dbb9.tar.gz samba-589d995276f4868a1801d5d41f9a527a6323dbb9.tar.bz2 samba-589d995276f4868a1801d5d41f9a527a6323dbb9.zip |
s4 dns: Give better test output on RCODE mismatch
Diffstat (limited to 'source4')
-rw-r--r-- | source4/scripting/python/samba/tests/dns.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/source4/scripting/python/samba/tests/dns.py b/source4/scripting/python/samba/tests/dns.py index 60003fcf7a..ed78d56dd3 100644 --- a/source4/scripting/python/samba/tests/dns.py +++ b/source4/scripting/python/samba/tests/dns.py @@ -28,11 +28,30 @@ from samba.tests import TestCase class DNSTest(TestCase): + def errstr(self, errcode): + "Return a readable error code" + string_codes = [ + "OK", + "FORMERR", + "SERVFAIL", + "NXDOMAIN", + "NOTIMP", + "REFUSED", + "YXDOMAIN", + "YXRRSET", + "NXRRSET", + "NOTAUTH", + "NOTZONE", + ] + + return string_codes[errcode] + + def assert_dns_rcode_equals(self, packet, rcode): "Helper function to check return code" p_errcode = packet.operation & 0x000F self.assertEquals(p_errcode, rcode, "Expected RCODE %s, got %s" % \ - (rcode, p_errcode)) + (self.errstr(rcode), self.errstr(p_errcode))) def assert_dns_opcode_equals(self, packet, opcode): "Helper function to check opcode" |