]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Test message encoding with EDNS options.
authorBrian Wellington <bwelling@xbill.org>
Wed, 17 Jun 2020 22:13:12 +0000 (15:13 -0700)
committerBrian Wellington <bwelling@xbill.org>
Wed, 17 Jun 2020 22:13:12 +0000 (15:13 -0700)
tests/test_message.py

index ab40a05e13443b63f834a107b42e6dd42effa1bf..4e80e01eca6ab5bb6d5ee8fc424872ba72e026f2 100644 (file)
@@ -144,6 +144,15 @@ class MessageTestCase(unittest.TestCase):
         m = dns.message.from_wire(goodwire3)
         self.assertEqual(str(m), query_text_2)
 
+    def test_EDNS_options_wire(self):
+        m = dns.message.make_query('foo', 'A')
+        opt = dns.edns.GenericOption(3, b'data')
+        m.use_edns(options=[opt])
+        m2 = dns.message.from_wire(m.to_wire())
+        self.assertEqual(m2.edns, 0)
+        self.assertEqual(len(m2.options), 1)
+        self.assertEqual(m2.options[0], opt)
+
     def test_TooBig(self):
         def bad():
             q = dns.message.from_text(query_text)