コード例 #1
0
 def test_hash_invalid_algorithm(self):
     data = (
         "example.com",
         "9F1AB450CF71D",
         0,
         "qfo2sv6jaej4cm11a3npoorfrckdao2c",
         1,
     )
     with self.assertRaises(ValueError):
         dnssec.nsec3_hash(data[0], data[1], data[2], 10)
     with self.assertRaises(ValueError):
         dnssec.nsec3_hash(data[0], data[1], data[2], "foo")
コード例 #2
0
 def test_hash_invalid_salt_length(self):
     data = (
         "example.com",
         "9F1AB450CF71D",
         0,
         "qfo2sv6jaej4cm11a3npoorfrckdao2c",
         1,
     )
     with self.assertRaises(ValueError):
         hash = dnssec.nsec3_hash(data[0], data[1], data[2], data[4])
コード例 #3
0
 def test_hash_function(self):
     for d in self.DATA:
         hash = dnssec.nsec3_hash(d[0], d[1], d[2], d[4])
         self.assertEqual(hash, d[3].upper(), "Error {}".format(d))