windows = Bitmap(windows)
self.windows = tuple(windows.windows)
- def to_text(self, origin=None, relativize=True, **kw):
+ def _next_text(self):
next = base64.b32encode(self.next).translate(b32_normal_to_hex).lower().decode()
next = next.rstrip("=")
+ return next
+
+ def to_text(self, origin=None, relativize=True, **kw):
+ next = self._next_text()
if self.salt == b"":
salt = "-"
else:
next = parser.get_counted_bytes()
bitmap = Bitmap.from_wire_parser(parser)
return cls(rdclass, rdtype, algorithm, flags, iterations, salt, next, bitmap)
+
+ def next_name(self, origin=None):
+ return dns.name.from_text(self._next_text(), origin)
import struct
import unittest
-import dns.wire
import dns.exception
import dns.name
import dns.rdata
import dns.rdataclass
import dns.rdataset
import dns.rdatatype
-from dns.rdtypes.ANY.OPT import OPT
-from dns.rdtypes.ANY.LOC import LOC
-from dns.rdtypes.ANY.GPOS import GPOS
import dns.rdtypes.ANY.RRSIG
import dns.rdtypes.IN.APL
import dns.rdtypes.util
import dns.tokenizer
import dns.ttl
import dns.wire
-
+import tests.md_module
import tests.stxt_module
import tests.ttxt_module
-import tests.md_module
+from dns.rdtypes.ANY.GPOS import GPOS
+from dns.rdtypes.ANY.LOC import LOC
+from dns.rdtypes.ANY.OPT import OPT
from tests.util import here
finally:
dns.rdata._allow_relative_comparisons = saved
+ def test_nsec3_next_name(self):
+ rdata = dns.rdata.from_text(
+ "in",
+ "nsec3",
+ "1 1 0 - CK0Q2D6NI4I7EQH8NA30NS61O48UL8G5 NS SOA RRSIG DNSKEY NSEC3PARAM",
+ )
+ origin = dns.name.from_text("com")
+ expected_rel = dns.name.from_text(
+ "ck0q2d6ni4i7eqh8na30ns61o48ul8g5", origin=None
+ )
+ expected_abs = dns.name.from_text("ck0q2d6ni4i7eqh8na30ns61o48ul8g5.com.")
+ self.assertEqual(rdata.next_name(), expected_rel)
+ self.assertEqual(rdata.next_name(origin), expected_abs)
+
class UtilTestCase(unittest.TestCase):
def test_Gateway_bad_type0(self):