def test_audit_is_created(self): n = Nominal.objects.create(name="nominal") c = CashBook(name="current", nominal=n) c.save() t = CashBookHeader(date=date.today(), cash_book=c) t.save() self.assertEqual( len(CashBookHeader.history.all()), 1 # created audit )
def test_audit_is_created(self): n = Nominal.objects.create(name="nominal") c = CashBook(name="current", nominal=n) c.save() h = CashBookHeader(date=date.today(), cash_book=c) h.save() l = CashBookLine.objects.create(header=h, line_no=1, description="description") self.assertEqual( len(CashBookLine.history.all()), 1 # created audits )
def test_queryset_deleted(self): n = Nominal.objects.create(name="nominal") c = CashBook(name="current", nominal=n) c.save() t = CashBookHeader(date=date.today(), cash_book=c) t.save() CashBookHeader.objects.all().delete() self.assertEqual( len(CashBookHeader.history.all()), 1 # created audit only # deleted audit is not created # use bulk_delete_with_history for deleted audits )
def test_queryset_deleted(self): n = Nominal.objects.create(name="nominal") c = CashBook(name="current", nominal=n) c.save() h = CashBookHeader(date=date.today(), cash_book=c) h.save() l = CashBookLine.objects.create(header=h, line_no=1, description="description") CashBookLine.objects.all().delete() self.assertEqual( len(CashBookLine.history.all()), 1 # created audit only # deleted audit is not created # use bulk_delete_with_history for deleted audits )