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