]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
enable TSIG text format testing
authorBob Halley <halley@dnspython.org>
Fri, 28 Aug 2020 01:53:17 +0000 (18:53 -0700)
committerBob Halley <halley@dnspython.org>
Fri, 28 Aug 2020 01:53:17 +0000 (18:53 -0700)
tests/test_tsig.py

index b8a38b480c6bb8cb9047f7e92f2b0353d7320b1b..a016cf81d646fc8aef3ebf121c2f6c020d4f0528 100644 (file)
@@ -246,7 +246,7 @@ class TSIGTestCase(unittest.TestCase):
     def test_hmac_sha512_256(self):
         self._test_truncated_algorithm(dns.tsig.HMAC_SHA512_256, 256)
 
-    def text_format(self):
+    def _test_text_format(self, alg):
         key = dns.tsig.Key('foo', b'abcdefg', algorithm=alg)
         q = dns.message.make_query('example', 'a')
         q.use_tsig(key)
@@ -257,10 +257,19 @@ class TSIGTestCase(unittest.TestCase):
         self.assertEqual(tsig2, q.tsig[0])
 
         q = dns.message.make_query('example', 'a')
-        q.use_tsig(key, other_data='abc')
+        q.use_tsig(key, other_data=b'abc')
         q.use_tsig(key)
         _ = q.to_wire()
 
         text = q.tsig[0].to_text()
         tsig2 = dns.rdata.from_text('ANY', 'TSIG', text)
         self.assertEqual(tsig2, q.tsig[0])
+
+    def test_text_hmac_sha256_128(self):
+        self._test_text_format(dns.tsig.HMAC_SHA256_128)
+
+    def test_text_hmac_sha384_192(self):
+        self._test_text_format(dns.tsig.HMAC_SHA384_192)
+
+    def test_text_hmac_sha512_256(self):
+        self._test_text_format(dns.tsig.HMAC_SHA512_256)