def setUp(self): super(CTTDummyRebuildTest, self).setUp() tpms_before = Node._tpm.objects.count() Node._tpm.objects.all().delete() self.assertNotEqual(tpms_before, Node._tpm.objects.count()) Node._rebuild_tree() self.assertEqual(tpms_before, Node._tpm.objects.count())
def setUp(self): super(CTTDummyRebuildQSTest, self).setUp() tpms_before = Node._tpm.objects.count() Node._tpm.objects.filter( descendant__in=Node.objects.filter( name__in=['1', '2', '3', '4'])).\ delete() self.assertNotEqual(tpms_before, Node._tpm.objects.count()) Node._rebuild_qs(Node.objects.filter(name='2')) self.assertEqual(tpms_before, Node._tpm.objects.count())