Skip to content

Commit

Permalink
fix DNSKEYTest::test_ds_hash
Browse files Browse the repository at this point in the history
`ds_hash()` expect bytes, encode string in test

for ionos-cloud#198
  • Loading branch information
zeromind committed Feb 4, 2022
1 parent 0cc7b8a commit 9ef898d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions dim-testsuite/tests/dnssec_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_dnskey_tag(self):
assert dnskey_tag(dnskey_rdata(flags, protocol, algorithm, pubkey)) == 20842

def test_ds_hash(self):
assert ds_hash('a.com', dnskey_rdata(flags, protocol, algorithm, pubkey), hashlib.sha1) == \
assert ds_hash('a.com'.encode('utf-8'), dnskey_rdata(flags, protocol, algorithm, pubkey), hashlib.sha1) == \
'91053B9A59B05FB08D5469472A5F1B588C5CA092'
assert ds_hash('a.com', dnskey_rdata(flags, protocol, algorithm, pubkey), hashlib.sha256) == \
assert ds_hash('a.com'.encode('utf-8'), dnskey_rdata(flags, protocol, algorithm, pubkey), hashlib.sha256) == \
'FFB15B5EF961E0AE3474E7B868FBD3C8F7C861D3BEA4527382CBDA791D4B9FF4'
2 changes: 1 addition & 1 deletion dim/dim/models/dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ def dnskey_tag(rdata):
return ac & 0xFFFF


def ds_hash(owner, rdata, digest_function):
def ds_hash(owner: bytes, rdata: bytes, digest_function):
if type(owner) != bytes:
raise TypeError("owner must be of type bytes, got {}".format(type(owner)))
if type(rdata) != bytes:
Expand Down

0 comments on commit 9ef898d

Please sign in to comment.