def test_flow_control(self): invoice = MyCharInvoide() invoice.number = 1234 invoice.full_clean() invoice.save() self.assertEqual(invoice.status, CharChoices.NEW) invoice.status = CharChoices.INVOICED # Raise ValidationError when validate status self.assertRaises(exceptions.ValidationError, lambda: invoice.full_clean())
def test_status_invoice(self): invoice = MyCharInvoide() invoice.number = 1234 invoice.full_clean() invoice.save() self.assertEqual(invoice.status, 'NW')
def test_create_invoice(self): invoice = MyCharInvoide() invoice.number = 1234 invoice.full_clean() invoice.save() self.assertTrue(MyCharInvoide.objects.count())