diff options
author | Bob Halley <halley@dnspython.org> | 2020-09-01 06:51:25 -0700 |
---|---|---|
committer | Bob Halley <halley@dnspython.org> | 2020-09-01 06:51:25 -0700 |
commit | 97e35f2b0ec57a38b473744f1cd7783044bc1129 (patch) | |
tree | 5ab4505a502d63ad77730f4528bf83f51b4ba0f9 /tests | |
parent | f333e7f11646b22f6ca0a4964dcf485e587a9388 (diff) | |
download | dnspython-97e35f2b0ec57a38b473744f1cd7783044bc1129.tar.gz |
add some versioned zone test cases
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_zone.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_zone.py b/tests/test_zone.py index 78fbb28..3f938c6 100644 --- a/tests/test_zone.py +++ b/tests/test_zone.py @@ -32,6 +32,7 @@ import dns.rdataset import dns.rdataclass import dns.rdatatype import dns.rrset +import dns.versioned import dns.zone import dns.node @@ -801,5 +802,29 @@ class ZoneTestCase(unittest.TestCase): self.assertTrue(rds is not rrs) self.assertFalse(isinstance(rds, dns.rrset.RRset)) + +class VersionedZoneTestCase(unittest.TestCase): + def testUseTransaction(self): + z = dns.zone.from_text(example_text, 'example.', relativize=True, + zone_factory=dns.versioned.Zone) + with self.assertRaises(dns.versioned.UseTransaction): + z.find_node('not_there', True) + with self.assertRaises(dns.versioned.UseTransaction): + z.delete_node('not_there') + with self.assertRaises(dns.versioned.UseTransaction): + z.find_rdataset('not_there', 'a', create=True) + with self.assertRaises(dns.versioned.UseTransaction): + z.get_rdataset('not_there', 'a', create=True) + with self.assertRaises(dns.versioned.UseTransaction): + z.delete_rdataset('not_there', 'a') + with self.assertRaises(dns.versioned.UseTransaction): + z.replace_rdataset('not_there', None) + + def testSelectDefaultPruningPolicy(self): + z = dns.zone.from_text(example_text, 'example.', relativize=True, + zone_factory=dns.versioned.Zone) + z.set_pruning_policy(None) + self.assertEqual(z._pruning_policy, z._default_pruning_policy) + if __name__ == '__main__': unittest.main() |