diff options
| author | Bob Halley <halley@dnspython.org> | 2020-05-03 14:49:55 -0700 |
|---|---|---|
| committer | Bob Halley <halley@dnspython.org> | 2020-05-03 14:49:55 -0700 |
| commit | f721d7b85d488327699e4cd0e71693dc8eb0f12e (patch) | |
| tree | c37d252693a60d13d1846e1e7c8ab67ec48aa545 /tests/test_message.py | |
| parent | d413f2cfe3a9fbadfb442b6e607cf558789a33c9 (diff) | |
| download | dnspython-f721d7b85d488327699e4cd0e71693dc8eb0f12e.tar.gz | |
IDNA support for zones, messages, names in rdata, rrsets, and rdatasets.
Diffstat (limited to 'tests/test_message.py')
| -rw-r--r-- | tests/test_message.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_message.py b/tests/test_message.py index b799586..166d7e8 100644 --- a/tests/test_message.py +++ b/tests/test_message.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 # Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license # Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. @@ -24,6 +25,7 @@ import dns.message import dns.name import dns.rdataclass import dns.rdatatype +import dns.rrset query_text = """id 1234 opcode QUERY @@ -91,6 +93,16 @@ goodhex3 = b'04d2010f0001000000000001047777777709646e73707974686f6e' \ goodwire3 = binascii.unhexlify(goodhex3) +idna_text = """id 1234 +opcode QUERY +rcode NOERROR +flags QR AA RD +;QUESTION +Königsgäßchen. IN NS +;ANSWER +Königsgäßchen. 3600 IN NS Königsgäßchen. +""" + class MessageTestCase(unittest.TestCase): def test_comparison_eq1(self): @@ -224,5 +236,21 @@ class MessageTestCase(unittest.TestCase): dns.message.from_wire(wire[:-3]) self.assertRaises(dns.message.Truncated, bad) + def test_IDNA_2003(self): + a = dns.message.from_text(idna_text, idna_codec=dns.name.IDNA_2003) + rrs = dns.rrset.from_text_list('xn--knigsgsschen-lcb0w.', 30, + 'in', 'ns', + ['xn--knigsgsschen-lcb0w.'], + idna_codec=dns.name.IDNA_2003) + self.assertEqual(a.answer[0], rrs) + + def test_IDNA_2008(self): + a = dns.message.from_text(idna_text, idna_codec=dns.name.IDNA_2008) + rrs = dns.rrset.from_text_list('xn--knigsgchen-b4a3dun.', 30, + 'in', 'ns', + ['xn--knigsgchen-b4a3dun.'], + idna_codec=dns.name.IDNA_2008) + self.assertEqual(a.answer[0], rrs) + if __name__ == '__main__': unittest.main() |
