summaryrefslogtreecommitdiff
path: root/tests/test_rdata.py
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2020-06-01 13:49:59 -0700
committerBob Halley <halley@dnspython.org>2020-06-01 13:49:59 -0700
commit3494e7f8c9edff27d9624a07c142c9839586ea06 (patch)
tree78f6a92135103c0944395dd87fa67c1e80b1eb82 /tests/test_rdata.py
parent5a3df82e3f93c4f480f96f78de8678504282a3e0 (diff)
downloaddnspython-3494e7f8c9edff27d9624a07c142c9839586ea06.tar.gz
NSEC should NOT be downcased when canonicalized, nor should HIP or IPSECKEY; test all
Diffstat (limited to 'tests/test_rdata.py')
-rw-r--r--tests/test_rdata.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/test_rdata.py b/tests/test_rdata.py
index ed2c3f3..872bdd9 100644
--- a/tests/test_rdata.py
+++ b/tests/test_rdata.py
@@ -139,6 +139,8 @@ class RdataTestCase(unittest.TestCase):
#
# types that don't have names: HINFO
#
+ # NSEC3, whose downcasing was removed by RFC 6840 section 5.1
+ #
cases = [
('SOA', 'NAME NAME 1 2 3 4 5'),
('AFSDB', '0 NAME'),
@@ -147,7 +149,6 @@ class RdataTestCase(unittest.TestCase):
('KX', '10 NAME'),
('MX', '10 NAME'),
('NS', 'NAME'),
- ('NSEC', 'NAME A'),
('NAPTR', '0 0 a B c NAME'),
('PTR', 'NAME'),
('PX', '65535 NAME NAME'),
@@ -173,5 +174,23 @@ class RdataTestCase(unittest.TestCase):
expected_wire = f.getvalue()
self.assertEqual(digestable_wire, expected_wire)
+ def test_digestable_no_downcasing(self):
+ # Make sure that currently known types with domain names that
+ # are NOT supposed to be downcased when canonicalized are
+ # handled properly.
+ #
+ cases = [
+ ('HIP', '2 200100107B1A74DF365639CC39F1D578 Ym9ndXM= NAME name'),
+ ('IPSECKEY', '10 3 2 NAME Ym9ndXM='),
+ ('NSEC', 'NAME A'),
+ ]
+ for rdtype, text in cases:
+ origin = dns.name.from_text('example')
+ rdata = dns.rdata.from_text(dns.rdataclass.IN, rdtype, text,
+ origin=origin, relativize=False)
+ digestable_wire = rdata.to_digestable(origin)
+ expected_wire = rdata.to_wire(origin=origin)
+ self.assertEqual(digestable_wire, expected_wire)
+
if __name__ == '__main__':
unittest.main()