summaryrefslogtreecommitdiff
path: root/tests/test_bugs.py
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2016-11-15 06:13:29 -0800
committerBob Halley <halley@dnspython.org>2016-11-15 06:13:29 -0800
commit5f314b28260e6cdf8d1f21c81c7a03a56752405b (patch)
treea06221643619e0fc5254a4ae5ba85906dfc7e541 /tests/test_bugs.py
parent6c73bd5d2364341f242598feaa0f6960bf2b1bf8 (diff)
downloaddnspython-5f314b28260e6cdf8d1f21c81c7a03a56752405b.tar.gz
add regression test for APL trailing zero suppression
Diffstat (limited to 'tests/test_bugs.py')
-rw-r--r--tests/test_bugs.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_bugs.py b/tests/test_bugs.py
index d26d85b..717cdce 100644
--- a/tests/test_bugs.py
+++ b/tests/test_bugs.py
@@ -19,6 +19,8 @@ try:
except ImportError:
import unittest
+import binascii
+
import dns.rdata
import dns.rdataclass
import dns.rdatatype
@@ -68,5 +70,17 @@ class BugsTestCase(unittest.TestCase):
wire, 0, rdlen)
self.failUnless(rdata == rdata2)
+ def test_trailing_zero_APL(self):
+ in4 = "!1:127.0.0.0/1"
+ rd4 = dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.APL, in4)
+ out4 = rd4.to_digestable(dns.name.from_text("test"))
+ text4 = binascii.hexlify(out4).decode('ascii')
+ self.failUnless(text4 == '000101817f')
+ in6 = "!2:::1000/1"
+ rd6 = dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.APL, in6)
+ out6 = rd6.to_digestable(dns.name.from_text("test"))
+ text6 = binascii.hexlify(out6).decode('ascii')
+ self.failUnless(text6 == '0002018f000000000000000000000000000010')
+
if __name__ == '__main__':
unittest.main()