summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2020-08-27 18:53:17 -0700
committerBob Halley <halley@dnspython.org>2020-08-27 18:53:17 -0700
commitc5524f9cee3099ab2bf78c3606c2c18043a1c4b3 (patch)
tree3a2741010bb496a696911486b8ec3aee5e9414a1
parent6c3d900fa668292c477ddbf8855e2e611cb85a61 (diff)
downloaddnspython-c5524f9cee3099ab2bf78c3606c2c18043a1c4b3.tar.gz
enable TSIG text format testing
-rw-r--r--tests/test_tsig.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/test_tsig.py b/tests/test_tsig.py
index b8a38b4..a016cf8 100644
--- a/tests/test_tsig.py
+++ b/tests/test_tsig.py
@@ -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)