summaryrefslogtreecommitdiff
path: root/tests/test_resolution.py
diff options
context:
space:
mode:
authorBrian Wellington <bwelling@xbill.org>2020-07-01 13:06:14 -0700
committerBrian Wellington <bwelling@xbill.org>2020-07-01 13:06:14 -0700
commit8d1360481095e29ce63c9777b37d9eb0c411f9b7 (patch)
treec93777b337cc5d6ea09ad3810a4f50334dd0bfac /tests/test_resolution.py
parent5765181c220b96b1543395faaf5e43eb778a45ff (diff)
downloaddnspython-8d1360481095e29ce63c9777b37d9eb0c411f9b7.tar.gz
Add dns.tsig.Key class.
This creates a new class to represent a TSIG key, containing name, secret, and algorithm. The keyring format is changed to be {name : key}, and the methods in dns.tsigkeyring are updated to deal with old and new formats. The Message class is updated to use dns.tsig.Key, although (to avoid breaking existing code), it stores them in the keyring field. Message.use_tsig() can accept either explicit keys, or keyrings; it will extract and/or create a key. dns.message.from_wire() can accept either a key or a keyring in the keyring parameter. If passed a key, it will now raise if the TSIG record in the message was signed with a different key. If passed a keyring containing keys (as opposed to bare secrets), it will check that the TSIG record's algorithm matches that of the key.
Diffstat (limited to 'tests/test_resolution.py')
-rw-r--r--tests/test_resolution.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/test_resolution.py b/tests/test_resolution.py
index 1ba4463..aa1cd0c 100644
--- a/tests/test_resolution.py
+++ b/tests/test_resolution.py
@@ -197,11 +197,11 @@ class ResolutionTestCase(unittest.TestCase):
self.resolver.keyring = dns.tsigkeyring.from_text({
'keyname.' : 'NjHwPsMKjdN++dOfE5iAiQ=='
})
+ key = next(iter(self.resolver.keyring.values()))
self.resolver.keyname = dns.name.from_text('keyname.')
(request, answer) = self.resn.next_request()
self.assertFalse(request is None)
- self.assertEqual(request.keyring, self.resolver.keyring)
- self.assertEqual(request.keyname, self.resolver.keyname)
+ self.assertEqual(request.keyring, key)
def test_next_request_flags(self):
self.resolver.flags = dns.flags.RD | dns.flags.CD