def test_basic_add_remove4(self): # Move a record down the tree testing prune's ability to not delete # stuff. c = Domain(name='goo') c.save() self.assertFalse(c.purgeable) f_c = Domain(name='foo.goo') s, _ = SOA.objects.get_or_create(primary="foo", contact="foo", comment="foo.goo") f_c.soa = s f_c.save() self.assertFalse(f_c.purgeable) fqdn = "bar.x.y.z.foo.goo" label, the_domain = ensure_label_domain(fqdn) txt = TXT(label=label, domain=the_domain, txt_data="Nthing") txt.save() self.assertTrue(the_domain.purgeable) # txt makes the domain un-purgeable. self.assertFalse(prune_tree(the_domain)) txt.domain = the_domain.master_domain the_next_domain = the_domain.master_domain txt.save() self.assertFalse(Domain.objects.filter(pk=the_domain.pk)) # We should be able to delete now. self.assertTrue(prune_tree(the_domain)) the_domain = the_next_domain # txt makes the domain un-purgeable. y.z.foo.com self.assertFalse(prune_tree(the_domain)) txt.domain = the_domain.master_domain the_next_domain = the_domain.master_domain txt.save() self.assertFalse(Domain.objects.filter(pk=the_domain.pk)) # We should be able to delete now. the_domain = the_next_domain # txt makes the domain un-purgeable. z.foo.com self.assertFalse(prune_tree(the_domain)) txt.domain = the_domain.master_domain the_next_domain = the_domain.master_domain txt.save() self.assertFalse(Domain.objects.filter(pk=the_domain.pk)) # We should be able to delete now. the_domain = the_next_domain # txt makes the domain un-purgeable. foo.com self.assertFalse(prune_tree(the_domain))
def test_basic_add_remove4(self): # Move a record down the tree testing prune's ability to not delete # stuff. f_c = create_fake_zone("foo.goo", suffix="") self.assertFalse(f_c.purgeable) fqdn = "bar.x.y.z.foo.goo" label, the_domain = ensure_label_domain(fqdn) txt = TXT(label=label, domain=the_domain, txt_data="Nthing") txt.save() self.assertTrue(the_domain.purgeable) # txt makes the domain un-purgeable. self.assertFalse(prune_tree(the_domain)) txt.domain = the_domain.master_domain the_next_domain = the_domain.master_domain txt.save() self.assertFalse(Domain.objects.filter(pk=the_domain.pk)) # We should be able to delete now. self.assertTrue(prune_tree(the_domain)) the_domain = the_next_domain # txt makes the domain un-purgeable. y.z.foo.com self.assertFalse(prune_tree(the_domain)) txt.domain = the_domain.master_domain the_next_domain = the_domain.master_domain txt.save() self.assertFalse(Domain.objects.filter(pk=the_domain.pk)) # We should be able to delete now. the_domain = the_next_domain # txt makes the domain un-purgeable. z.foo.com self.assertFalse(prune_tree(the_domain)) txt.domain = the_domain.master_domain the_next_domain = the_domain.master_domain txt.save() self.assertFalse(Domain.objects.filter(pk=the_domain.pk)) # We should be able to delete now. the_domain = the_next_domain # txt makes the domain un-purgeable. foo.com self.assertFalse(prune_tree(the_domain))