summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2011-12-16 11:36:47 +0100
committerKai Blin <kai@samba.org>2011-12-17 02:46:08 +0100
commit589d995276f4868a1801d5d41f9a527a6323dbb9 (patch)
tree71e6bb84c4e84ab25d107bec509cd31d1f132187
parent8b82bad0065895e0417f095c6b9ed2ada31fbdaa (diff)
downloadsamba-589d995276f4868a1801d5d41f9a527a6323dbb9.tar.gz
samba-589d995276f4868a1801d5d41f9a527a6323dbb9.tar.bz2
samba-589d995276f4868a1801d5d41f9a527a6323dbb9.zip
s4 dns: Give better test output on RCODE mismatch
-rw-r--r--source4/scripting/python/samba/tests/dns.py21
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"