def test_zonemd_simple_absolute(self): zone = dns.zone.from_text(self.simple_example, origin='example', relativize=False) zone.verify_digest() zonemd = self._get_zonemd(zone) self.assertEqual(zonemd[0], zone.compute_digest(zonemd[0].hash_algorithm))
def test_zonemd_multiple_digests(self): zone = dns.zone.from_text(self.multiple_digests_example, origin='example') zone.verify_digest() zonemd = self._get_zonemd(zone) for rr in zonemd: if rr.scheme == 1 and rr.hash_algorithm in (1, 2): zone.verify_digest(rr) self.assertEqual(rr, zone.compute_digest(rr.hash_algorithm)) else: with self.assertRaises(dns.zone.DigestVerificationFailure): zone.verify_digest(rr)
def test_zonemd_no_digest(self): zone = dns.zone.from_text(self.simple_example, origin='example') zone.delete_rdataset(dns.name.empty, 'ZONEMD') with self.assertRaises(dns.zone.NoDigest): zone.verify_digest()
def test_zonemd_complex(self): zone = dns.zone.from_text(self.complex_example, origin='example') zone.verify_digest() zonemd = self._get_zonemd(zone) self.assertEqual(zonemd[0], zone.compute_digest(zonemd[0].hash_algorithm))