MCPcopy Create free account
hub / github.com/rthalley/dnspython / _test_truncated_algorithm

Method _test_truncated_algorithm

tests/test_tsig.py:257–265  ·  view source on GitHub ↗
(self, alg, length)

Source from the content-addressed store, hash-verified

255 self.assertRaises(ex, bad)
256
257 def _test_truncated_algorithm(self, alg, length):
258 key = dns.tsig.Key("foo", b"abcdefg", algorithm=alg)
259 q = dns.message.make_query("example", "a")
260 q.use_tsig(key)
261 q2 = dns.message.from_wire(q.to_wire(), keyring=key)
262
263 self.assertTrue(q2.had_tsig)
264 self.assertEqual(q2.tsig[0].algorithm, q.tsig[0].algorithm)
265 self.assertEqual(len(q2.tsig[0].mac), length // 8)
266
267 def test_hmac_sha256_128(self):
268 self._test_truncated_algorithm(dns.tsig.HMAC_SHA256_128, 128)

Callers 3

test_hmac_sha256_128Method · 0.95
test_hmac_sha384_192Method · 0.95
test_hmac_sha512_256Method · 0.95

Calls 2

use_tsigMethod · 0.45
to_wireMethod · 0.45

Tested by

no test coverage detected